Cloning a drive.
Hi, I was wondering if anyone could tell me the best way to clone a hard drive. I was looking at Clonezilla but was wondering if it could be done with dd within slackware.
Thanks. |
Quote:
|
So with different size drives this wouldn't work with dd?
|
Not if the new drive if smaller.
If the new drive is larger, you can just Code:
dd if=/dev/OLDDRIVE of=/dev/NEWDRIVE (Make ABSOLUTELY sure you don't mix them up!) |
with dd if you clone a 100 gb drive to a 10 gb drive it will get truncated and probably wont boot (like pouring a gallon of paint into a quart container -- you will get a lot of spillage).
if you clone a 10 gb drive to a 100 gb drive. it will boot up but will act as if it has only 10 gb of space (you will be wasting 90 gb). there are probably ways to use gparted to make the rest of the space useful (i think that is how some live-usb's do it). |
Couldn't you just mount both of them and use rsync?
|
Quote:
|
Quote:
|
So, if I used identical drives
dd=/dev/OLDDRIVE of=/dev/NEWDRIVE would work? And the new cloned drive would boot? |
Quote:
|
mutput, if I wanted to keep a clone image on spare drive how would you do that?
dd=/dev/OLDDRIVE of=/root/clone.iso To use repeatedly. |
Quote:
dd if=/dev/OLDDRIVE of=/SPAREDRIVEMOUNT/path/to/backup.img.iso.bak.clone.drv Should work for what I think you mean. |
Yes, that's what I was meaning, thanks.
|
Quote:
Even from a booted drive it works OK. After booting with the backed up drive it looks as if it was switched off suddenly so the filesystem check will repair any 'open' files. https://wiki.archlinux.org/index.php/Disk_Cloning Also add the bs=1M option so the copying will go faster. You could also copy 'per partition' and MBR+partition table separately like : dd if=/dev/sda of=/dev/sdb bs=512 count=1 dd if=/dev/sda1 of=/dev/sdb1 bs=1M dd if=/dev/sda2 of=/dev/sdb2 bs=1M etc. Nice trick (during copying): find the pid of the dd process : ps -ef | grep dd from another terminal : kill -s SIGUSR1 <pid> That will print the amount of data copied so far. Ofcourse if you could unmount the drive to be copied that is preferable. |
this thread has a lot of info on dd:
http://www.linuxquestions.org/questi...ommand-362506/ |
All times are GMT -5. The time now is 01:38 PM. |