For some reason there don't seem to be too many questions or answers about using dd for creating "smaller" image files with the conv=sparse option here.
So when using dd for image creation, can I safely use e.g. dd if=/dev/sda of=/media/storage-device/sda.img conv=sparse to get an image file that uses (much) less space on the target?
Don't know if it matters, but in this case the source would be a SSD with EXT4 filesystem and only 15% used (as it is quite new), and the target also would use EXT4 fs.
Or is this possibly a rather bad idea (under certain circumstances) and may lead to problems (later, e.g. when I need to restore it)?
I am also wondering if this would work when the target is a network mount or filesystem?
The goal would be to get an image file of either a partition or (even better) a whole disk that doesn't take much more space than needed, while keeping it easily mount- and usable.
Extra compression isn't really needed or wanted, and it usually also would make the resulting image not mountable any more I guess, so I can live without it.
And I know Clonezilla can do stuff like saving only used sectors, but I don't like its limitations, e.g. Due to the image format limitation, the image can not be explored or mounted. (And of course dd is already available on every system.)
Many thanks in advance
gzipcompression will likely give a small image and that is definitely safe.
zerofreewith ext file systems or generally with dd by creating a huge file filled with zero-bytes and then remove that file. This is a slow process, so I prefer Clonezilla, but I understand that you want to explore this process. Anyway, I don't know if the method you suggest will work, and I'm looking forward to your result :-P
tarwith or without compression to get a useful 'image' of a partition. This is not a true image, but can be very useful in order to store the content, so that it can be restored to the same and even to a smaller partition.