I've seen various posts discussing the use of dd for creating an image of a drive and only storing 'used data'. Before posing the problem/question, let's assume a few things.
Assumptions
- The drive to clone/image is /dev/sda
- /dev/sda is 10TBs
- Used space on /dev/sda is 1TB
- Storage of the image is to some remote CIFS mounted location
Question/Problem
Using something like cp
with the --sparse=always
option in conjunction with dd
should produce a sparse file so that the file appears as 1GB:
cp --sparse=always <(dd if=/dev/sda bs=8M) /mnt/remote/location/disk.img
Alternatively something like below, should compress all zeroed space:
dd if=/dev/sda1 | gzip -c > /mnt/remote/location/disk.img.gz
So, what is the impact of a sparse image file upon restore? Will the transferred data be 1GB, or 10GBs including the perceived empty/zeroed space? This is obviously a consideration for assessing potential network load and time-to-restore.
P.S. I understand there are other options such as Clonezilla and something like ddrescue will allow resume capability but the question is specifically about using dd in the context above.
Thanks.