rsync or dd to clone a hard drive?

JD jd1008 at gmail.com
Wed Oct 6 16:39:13 UTC 2010



On 10/06/2010 07:58 AM, Maxime Alarie wrote:
>
> I have never used dd to clone a hard disk.
>
> I use rsync for a lot of my backups , and I was wondering what would 
> be the best tool to clone a disk. I don’t want 3^rd party software 
> also. I want built in command line tools.
>
> I know rsync will resync where it left off if I encounter a problem, 
> what about dd? Do I absolutely have to creat an image before cloning? 
> Ex: dd if=/dev/sda of=sda.img or I can use dd if=/dev/sda of=/dev/sdb?
>
> Thanks.
>
Never run dd on a mounted disk or partition. You will not get a correct
snapshot, and if you restore from such a backup, yo will end up with a
corrupted file system. Why? Because a mounted file system, probably actively
being used by something, will experience changes. These changes will likely
not be reflected in the backup image if the offset where dd is reading is
ahead of where the changes are occurring.

You mentioned clone. I assume you mean you have another drive, partitioned
similarly to what you want to clone, or has a partition that is at least 
equal
in size to the partition you want to clone with dd. Is this correct?
If yes, then both partitions must be unmounted. then running
dd from one partition to the other will not be a problem.
The only issue you MIGHT have is this: if the destination partition is
much larger than the source partition, then you will not see the unused
remainder of the target partition when you mount the target partition.
The filesystem will report "full" if you fill t up-to the size of the 
original
partition. Caveat Emptor!



More information about the users mailing list