LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-24-2012, 02:12 PM   #1
NoDiskNoFun
LQ Newbie
 
Registered: Aug 2012
Posts: 2

Rep: Reputation: Disabled
How to shrink .img file?


Hey Dudes,

i tried to shrink an Image of my ARM-Linux. but resize2fs told me that the size of the file is the minimum size i can use, but i know that there is up to 7oo MB free space in that file.

Some details:

It got an MS-DOS partition table and its formatted in ext4


thanks for help,
NoDiskNoFun
 
Old 08-24-2012, 02:47 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,289

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
Have you tried

gzip -9 your.img

It writes your.img.gz
 
Old 08-24-2012, 03:04 PM   #3
NoDiskNoFun
LQ Newbie
 
Registered: Aug 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
no i need it smaller for faster flashing.
i meant something like shrink HDD (resize2fs /dev/sda1 ???M)
 
Old 08-24-2012, 03:41 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,980

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
Your image is a result of the drive structure so you want to make a smaller drive and copy the data to it.

You could do as business_kid suggests after you zero out free space. The zeros would compress a lot but still wait to write them on a dd command.

Might move to file based copy and could pipe it via some compression.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Mounting .img file (chromiumos.img); can't mount it?? Help please? linus72 Linux - General 2 11-27-2009 08:11 PM
How to grow/shrink a file? neo_in_matrix Programming 10 03-18-2007 05:32 PM
shrink file system with out unmounting ravikumarG AIX 2 06-29-2005 08:48 AM
DVD Shrink Open File fails iab941 Linux - Software 1 07-04-2004 03:58 AM
DVD Shrink Open File fails iab941 Linux - Newbie 1 06-22-2004 02:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration