[NTLUG:Discuss] backing up a full disk image to external disk

Chris Cox cjcox at acm.org
Sat Dec 9 17:22:13 CST 2006


Ed Leach wrote:
> After some additional hunting around I found this:
> 
> http://wiki.linuxquestions.org/wiki/Dd ---
> 
> Creating a hard drive backup image
> 
> # dd if=/dev/hda | gzip > /mnt/hdb1/system_drive_backup.img.gz

No need for dd:

gzip < /dev/hda > /mnt/hdb1/system_drive_backup.img.gz

To restore:

zcat /mnt/hdb1/system_drive_backup.img.gz > /dev/hda

You also do this kind of thing to a remote area:

gzip < /dev/hda | ssh remote-machine "cat >system_drive_backup.img.gz"

ssh remote-machine "gzip -d -c system_drive_backup.img.gz" > /dev/hda

An uncompressed image copy of a partition (instead of the whole drive)
is easily mountable through the loopback device.

cp /dev/hda1 /mnt/hdb1/system_partition_backup.img
mkdir /mnt/tmpmnt
mount -o loop /mnt/hdb1/system_partition_backup.img /mnt/tmpmnt
cd /mnt/tmpmnt
ls

You can mount partitions on an uncompressed whole drive image as long
as you know the offset where the partition starts...




> 
> Here dd is making an image of the first harddrive, and piping it through 
> the gzip compression program. The compressed image is then placed in a 
> file on a seperate drive. To reverse the process:
> 
> # gzip -dc /mnt/hdb1/system_drive_backup.img.gz | dd of=/dev/hda
> 
> Here, gzip is decompressing (the -d switch) the file, sending the 
> results to stdout (the -c switch), which are piped to dd, and then 
> written to /dev/hda.
> 
> -----
> 
> I think this is what I'm looking for, although zipping 80 gigs might 
> keep it busy for awhile.
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> http://www.ntlug.org/mailman/listinfo/discuss
> 
> 




More information about the Discuss mailing list