rsync or dd to clone a hard drive?

Patrick Bartek bartek047 at yahoo.com
Wed Oct 6 16:23:04 UTC 2010


--- On Wed, 10/6/10, Maxime Alarie <malarie at processia.com> 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 3rd
> 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?

I would use dd to clone (or back up) an entire hard drive.  Easier.  You can even pipe it through gzip to get a compressed image file.

No, I don't think dd has the capability to automatically start where it left off if it's stopped.  Although, doing it manually seems possible, but I've never done it.

Either dd option above will work for cloning.  The first if you need to clone to drives on different machines.  The other, if the drive being cloned and the target are in the same machine.  Just be sure that the target drive is as large or larger than the source one.  In the latter case, you'll end up with empty space on the target drive.  You can either use a partition editor like gparted to expand the partitions to fill the space, or add new partitions, or leave it unpartitioned.

Also, the drives, either source or target, for safety, should not be in use.  If the source drive is the System, better to boot the machine with a LiveCD leaving both source and target drives unmounted.  This is the way I do it, if I'm cloning the System drive.  Although, I guess, if you set it to read-only during the cloning that should be okay.

B 


More information about the users mailing list