How to reduce space required by (Linux utility) dd created drive image
By angsuman, Gaea News NetworkSunday, December 5, 2010
a. Use gzip
An example command:
dd if=/dev/hda1 bs=1k conv=sync,noerror | gzip -c | ssh -c blowfish user@hostname “dd of=filename.gz bs=1k”
Notes:
1. gzip ensures less storage requirement for the image
2. blowfish algorithm is used while transferring the data because it reduces overhead, which leads to faster transfer, for the SSL connection
b. Reduce storage space by zeroing unused blocks
dd stores the entire partition, including blocks not currently used to store files. As the unused blocks often contains junk data, overall compression isn’t good. This can be rectified by filling the empty space with zeroes thereby enabling better compression of the image. The following command fills all unused blocks with zero:
dd if=/dev/zero of=delete_me bs=8M; rm delete_me
Notes:
1. This tip works for all filesystems
2. DO NOT use this on hard drive which you suspect to be corrupt
3. /dev/zero just supplies an unending stream of zero