LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-04-2008, 06:35 AM   #1
Slick666
Member
 
Registered: Feb 2006
Distribution: Ubuntu 8.04; Debian Etch
Posts: 167

Rep: Reputation: 33
7zip not performing so good


What I'm trying to do is compress a 1GB image of an SD card. I've DD'ed the whole device and want to a file.

The Image is 978MBs in size. The zip (not 7zip but just plain old zip) compresses it down to only 683 MBs. When I used 7zip I didn't get much better 675MBs.

The reason I think that it can do much better is that the disk image has three partitions

Code:
 - Part1 -  2.3MBs used
 - Part2 - 63.4MBs used
 - Part3 -  0.0MBs used
 - Total - 65.7MBs
If I took just the data files out I would get a smaller size. I want to dd so I can easily and simply pull and push the data but I don't want to waste 609Mbs on empty space.

What could I be doing wrong?
 
Old 11-04-2008, 07:00 AM   #2
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Compressing raw data using standard compression algorithms is not going to give good results. You're right, you'll get better compression if you compress the files themselves not the dd image of the drive.
 
Old 11-04-2008, 08:17 AM   #3
Slick666
Member
 
Registered: Feb 2006
Distribution: Ubuntu 8.04; Debian Etch
Posts: 167

Original Poster
Rep: Reputation: 33
It would be nice to keep the img format so I could dd the image right back to the device. Are there any algorithms that are specifically tailored for this operation?
 
Old 11-04-2008, 09:11 AM   #4
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
what you need to do is zero out all your unused sectors, this will allow it to compress much better. If it's ext2 or ext3 you can use a program call zerofree.
 
Old 11-04-2008, 09:22 AM   #5
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
regardless of filesystem, you can use dd to zero out the unused sectors.

dd if=/dev/zero of=/mytargetpartition/myzerofile

This will run until the file myzerofile fills all the free space in the partition, at which time it will bomb dd.

Then you just rm the file myzerofile and you've zeroed all the blank space in your partition.
 
Old 11-04-2008, 09:53 AM   #6
comm2k
LQ Newbie
 
Registered: Jul 2008
Posts: 28

Rep: Reputation: 16
Also if the content is already heavily compressed (MPEG audio/video for ex.) then there is little point in further trying to reduce its size by zip/7zip compression.
 
Old 11-04-2008, 09:59 AM   #7
Slick666
Member
 
Registered: Feb 2006
Distribution: Ubuntu 8.04; Debian Etch
Posts: 167

Original Poster
Rep: Reputation: 33
Quote:
Also if the content is already heavily compressed (MPEG audio/video for ex.) then there is little point in further trying to reduce its size by zip/7zip compression.
True, but the total spaced used by the files is only about 70MBs. I'm going to try
Quote:
dd if=/dev/zero of=/mytargetpartition/myzerofile
and see what I get. Here's the results so far.

Code:
LZMA     - 642M
Bzip2    - 671M
gZip     - 683M
Zip      - 683M
LZOP     - 704M
Original - 978M
 
Old 11-04-2008, 10:50 AM   #8
Slick666
Member
 
Registered: Feb 2006
Distribution: Ubuntu 8.04; Debian Etch
Posts: 167

Original Poster
Rep: Reputation: 33
Thanks Guys you Rock!

I implemented the suggestion by jiml8 and gziped compressed the file down to only 1.1MB! Thats 98% compression on the actual data and 99.888% compression total.

Thanks again to everyone LQ forums is awsome

Correction: My initial DD command wasn't quite correct because I on;y grabbed one partition. but even then it was reduced to 28 Megs.

Last edited by Slick666; 11-04-2008 at 11:32 AM. Reason: Correction for accurateness
 
Old 11-04-2008, 11:17 AM   #9
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
Just ignore this.

Last edited by estabroo; 11-04-2008 at 11:18 AM. Reason: doh!
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with 7zip sudarshan22 Linux - Newbie 2 12-26-2007 11:29 AM
What is 7zip iso browser Linux - Newbie 5 04-07-2006 05:39 PM
7zip in linux ? sunpascal Linux - Newbie 9 02-07-2006 04:25 AM
embbeding 7zip in konqueror patolfo Linux - Software 2 01-15-2006 12:55 PM
7zip, extracting to alternate directories. trey85stang Linux - Software 2 07-23-2005 03:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:00 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