Imaging Hard Drives

Kevin Hunter Kesling hunteke at gmail.com
Mon Aug 29 14:04:46 EDT 2016


At 11:29am -0400 Mon, 29 Aug 2016, Bernie Hoefer wrote:
> On 2016-08-29 08:10 EST, Kevin Hunter Kesling wrote:
>> Knowing this, you can prepare a device prior to taking an image so
>> that you can store your image a lot more efficiently. Basically,
>> write a bunch of zeros to a file, then delete that file, then take
>> your image. In CLI:
>>
>>     $ dd if=/dev/zero of=./big_empty_file_of_zeros bs=1M
>>     ... No space left on device
>>
>>     $ rm ./big_empty_file_of_zeros
>>
>>     $ dd if=/dev/sdX bs=1M | pigz > img.gz

> I still prefer partimage over your recommendation because partimage
> does not have to zero out the empty blocks. It `sees` that a block
> is free and thus doesn't even read it.

That's true.  A higher level tool can exploit knowledge of the 
filesystem layer to be smarter about the total job.  I suppose the piece 
I was keying in on with my suggestion of dd was the phrasing "to the 
*exact* condition" in your original message.  With dd, I know exactly 
what I'm getting (withstanding the empty_file_of_zeros), to the bit 
level.  How exact a condition do you require?  Does partimage place the 
files back exactly in the spot on the image from where they originally 
were (e.g., inodes, relative image geometry)?

> I also like how partimage will optionally break the partition image
> up into files of a user-specified size. I got in the habit of
> creating partition images composed of 2GiB-sized files back when I'd
> sometimes have to store them on a FAT16-formatted file system. (The
> max file size for FAT16 is 2GiB when it uses the default cluster
> size.)

Heh.  I suppose I'm really old school and like my CLI tools:

   $ dd if=/dev/sdX | pigz | split --bytes 2G

:-)

But I must admit the utility of partimage in a number of situations.  I 
specifically like item 1 of the list you linked:

     Partimage is faster. You don't have to wait for
     "dd if=/dev/zero" first. during the copy, free blocks
     are not read. Then, if 20 % of the partition is used,
     partimage will avoid two access to 80 % of the free
     areas.

Cheers,

Kevin


More information about the cinlug mailing list