1

This question already has an answer here:

I do have a USB mass storage device of 4GB, in which I had created two partition, both are of ext4. First partition is 1.5G and another one is 2.5G

First partition is almost full while second one is empty.

When I take dd of this device, then resultant dd file size is as expected i.e. 4GB. Now, when I gzip --best to this file, then I am expecting resultant gz file size must be aroung 1.4GB at the max. But practically, size remains aprrox. 2.5 GB.

The value, which I'm assuming, is wrong OR I miscalculated something ??

commands I had used are as:

dd if=/dev/sda of=USB.dd
gzip --best USB.dd

marked as duplicate by Gilles, G-Man, don_crissti, grochmal, Community Dec 27 '16 at 5:38

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 3
    Examine your disk dump prior to gzip'ing. Just because a portion of the disk is "empty" from your perspective, does not mean it is filled with an easily compressible pattern, like uniform 0x00. – user4556274 Dec 26 '16 at 12:00
  • Are you expecting me to shred the second partition before the above mentioned exercise ? – SHW Dec 26 '16 at 12:09
  • 1
    If you want to ensure the second partition is compressible, yes, you could do something like dd if=/dev/zero of=${partition_to_clear} or shred -z – user4556274 Dec 26 '16 at 12:17