LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Hard drive cloning (http://www.linuxquestions.org/questions/programming-9/hard-drive-cloning-415388/)

sabeel_ansari 02-14-2006 01:20 PM

Hard drive cloning
 
Hi,

I want to write a program which will create an exact copy of my hard drive onto a second external hard drive (thru the USB port). I have some basic idea on how to do this, but am not very clear. I am trying to find some material on this but cant seem to find much. If you have any idea on how to do this, can you give me some tips or point to some pages where I can get this info.

thanks in advance.
sabeel

puffinman 02-14-2006 01:39 PM

The utility dd can do this pretty easily. For instance, to clone your main drive (say /dev/hda) to a usb connected mass storage device (say /dev/sda1) you would do:

Code:

dd if=/dev/hda of=/dev/sda1 bs=1M
The bs argument is optional but using a bigger one should speed things up. You would of course need root access in order to copy directly from a device like this. Also make sure you have everything backed up somewhere in case something goes wrong (like accidentally switching the if and of arguments). :cry:

schneidz 02-14-2006 01:40 PM

i backup my thumbdrive by doing:
Code:

cat /dev/sda1 > usb.bak
and re-flash it by:
Code:

cat usb.bak > /dev/sda1
let me know if this gets you started.

thanks,
~schneidz


All times are GMT -5. The time now is 08:41 AM.