0

Problem: I am attempting to create an exact image of a compact flash and then compress the compact flash image for easier storage. The compact flash is not full (~1.5GB used, 32GB size). The problem is that when I compress the extracted image, it is not compressing well and I am not sure why.

I have tried multiple methods of compression and all result in no better than 50% compression ratio. I would assume that the zeros filling the ~30GB of the CF would compress very well and the resulting file would be ~1.5GB (or better).

What am I doing wrong? What am I overlooking?

Approach

  • Zero the CF: dd if=/dev/zero of=/dev/sdb bs=1M
  • Partition, Format, install files, data, etc (approx 1.5GB used)
  • Create image of CF: dd if=/dev/sdb of=cf.img
  • Compress CF (using gzip, bzip2, lzma, etc etc...)

Notes

  • I am zeroing the CF by using a USB media reader, connected to a Windows 7 box. The USB device is attached to a virtual machine running Linux.
3
  • Did you open the image in a hex editor?
    – Dennis
    Dec 31, 2012 at 16:10
  • I know this is not what you say you want to do, but why not just create a tar or cpio archive of the files and then compress that? Dec 31, 2012 at 19:33
  • @Scott it is much easier to be able to stick in a CF and click "burn" and have exactly what you need (all partitions, bootloader, etc) without additional configuration fuss.
    – Josh
    Dec 31, 2012 at 19:41

1 Answer 1

0

Answering my own question, but not sure why this is the case.

I tried out dban. Booted the ISO as a virtual machine, and used the "wipe" (write zero) option. Single pass. Followed the same steps afterwards as previously outlined. And the compression worked a LOT better. My compressed image was under 100MB.

The only thing I can guess now is that when using dd, /dev/zero was outputting something funny, or it was not being correctly written to the compact flash.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .