How to backup your disk with dd: Difference between revisions

From www.ReeltoReel.nl Wiki
Jump to navigation Jump to search
(Created page with "BACK-UP YOUR DISK WITH DD I had several bad experiences losing my data in my life. Sometimes because of the hardware, sometimes because of my stupidness or inexperience. At le...")
 
No edit summary
Line 1: Line 1:
BACK-UP YOUR DISK WITH DD
 
I had several bad experiences losing my data in my life. Sometimes because of the hardware, sometimes because of my stupidness or inexperience. At least, it learned to be careful. I backup my data regularly, and on several support concerning the important ones.
I had several bad experiences losing my data in my life. Sometimes because of the hardware, sometimes because of my stupidness or inexperience. At least, it learned to be careful. I backup my data regularly, and on several support concerning the important ones.



Revision as of 09:23, 2 September 2012

I had several bad experiences losing my data in my life. Sometimes because of the hardware, sometimes because of my stupidness or inexperience. At least, it learned to be careful. I backup my data regularly, and on several support concerning the important ones.


I sometimes back up my primary partition, where the system is set. If my drive crashed, I want to recover quickly a system without having to reinstall hundreds of applications. I have used several times Partimage and was satisfied. But now I tend to use dd, which basically do the same thing in just one line. The advantage is that it is by default on any Linux distribution.

To back it up on an usb disk :

$ sudo dd   if=/dev/hda1   |   gzip   -v   |   dd   of=/media/usbdisk/backup_hda1.gz

To backup my home and other data partitions, I just copy the files manually, it is faster and there is no need to backup such a thing as the boot sector. But of course you could use the same command above.

When you wish to restore the partition to a new hard drive, just :

$ zcat   /mnt/hdb5/sauvegarde.gz   |   dd   of=/dev/hda1

To do that, you will have probably booted on a live CD Linux as Knoppix to restore the crashed system. In any case, don’t overwrite the system you just booted on !

One tip if you want to back up only the boot sector :

$ sudo dd   if=/dev/hda   of=/home/secteur_boot.dd   bs=512   count=1

And to restore :

$ sudo dd   if=/home/secteur_boot.dd   of=/dev/hda   bs=512   count=1