capturing hdd image

Soldato
Joined
3 Dec 2002
Posts
4,033
Location
Groovin' @ the disco
Hi

I need to capture a hdd image of reference machine that's using mint linux.

I assume that if I boot up with the live usb pen drive and run the dd command this will disk duplicate the disk to a file, which I can dd back to another machine?

will this work? and what dd commands do I need?

Thanks
 
It'll work, yes, but it's a bit crude. Run a checksum against the disk and against the image, they should match. I went through a phase of using dd as a backup tool, it does work as such.

Check man dd and man gzip, but from memory I used:
dd if=/dev/sdX of=/mnt/disk.img bs=4k conv=sync
dd if=/mnt/disk.img of=/dev/sdX bs=4k conv=sync

You can make things significantly more space-efficient if you zero out the remaining space then compress it. Make a file that fills the remaining space, but only contains zeros, then delete it
dd if=/dev/zero of=/mnt/drive/zeros.img bs=4k && rm /mnt/drive/zeros.img

And then include gzip in the dd command.
dd if=/dev/sdX | gzip > /mnt/disk.img
gzip -d /mnt/disk.img | dd of=/dev/sdX

The syntax will be a bit hit and miss, I'm not on a linux box at the moment. Hopefully the premise is clear.
 
It'll work, yes, but it's a bit crude. Run a checksum against the disk and against the image, they should match. I went through a phase of using dd as a backup tool, it does work as such.

Check man dd and man gzip, but from memory I used:
dd if=/dev/sdX of=/mnt/disk.img bs=4k conv=sync
dd if=/mnt/disk.img of=/dev/sdX bs=4k conv=sync

You can make things significantly more space-efficient if you zero out the remaining space then compress it. Make a file that fills the remaining space, but only contains zeros, then delete it
dd if=/dev/zero of=/mnt/drive/zeros.img bs=4k && rm /mnt/drive/zeros.img

And then include gzip in the dd command.
dd if=/dev/sdX | gzip > /mnt/disk.img
gzip -d /mnt/disk.img | dd of=/dev/sdX

The syntax will be a bit hit and miss, I'm not on a linux box at the moment. Hopefully the premise is clear.

is there a better manner of doing a disk image? its a robson ssd in the machine, else I would jsut unplug and capture it using my mac.

Thanks
 
ddrescue is a more robust version of dd, otherwise there are systems like Norton's ghost that are set up to do pretty much exactly what you're asking for.

I would install mint on the second computer in the usual point & click fashion then copy the data across using rsync. That works so well that I've given up on disk imaging - it's usually the user data I care about, not the partition table or mbr. Is this viable for you? Rsync is essentially a really advanced copy.

Copying bit-for-bit from an ssd to a hard drive might not work, it would be interesting to hear back if you try it. There's a dark art of drive geometry out there that I've avoided by copying to and from identical disks (i.e. usually the same disk, in a few months time).
 
we (work) need to go for the image method, as the other techs have limited to no experience in using unix/linux, and there's no way I'm going to be responsible for 50 laptops. lol

I think clonezilla is the cloning method that's in favor at the moment, and I may look into that. :)

Thanks for your input.

edit: I got bored with messing with it.. I just created another live usb stick, resize the partition, created and ext2 partition. booted with the pen. dd the whole hdd to the new partition.
 
Last edited:
Back
Top Bottom