[Sussex] Simple cloning

Nico Kadel-Garcia nkadel at gmail.com
Tue Nov 14 10:50:50 UTC 2006


dd is wildly inefficient: it copies over empty blocks, discarded blocks,
etc., and I don't recommend it. rsync is great: you have to be careful with
the "exclude" syntax to avoid recursion, but it works well. /bin/cp -a is
almost as good as rsync, but doesn't allow you to efficiently do it twice.
tar has some useful options to avoid descending to other partitions, which
is handy for avoiding NFS mounts or

You also really, really want to make sure the partition layouts are similar.
For speed and ease, I tend to use only a few primary partitions and avoid
using LVM or LVM with different /tmp, /var, /usr, /home, /opt, etc., etc.,
etc. partitions to ease exactly this sort of duplication. One big swap
partition, one big / partition on a primary partition, and you're done in
almost all situations. I can program that with a few lines of fdisk code,
rather than the complexity of LVM and software RAID and allocating disk
sizes or squashing a directory that turns out to need to be larger than I
expected.

You also need to make sure that any necessary boot-time disk controllers are
in the system's initrd: look up the manual page for mkinitrd, and for
"grub-install" in order to create a new MBR that points to the right grub
configuration on your new disk.

I've used such procedures for, roughly, 15000 active servers, so I know it
works.


On 11/14/06, Brendan Whelan <b_whelan at mistral.co.uk> wrote:
>
> Thank you for the responses.
>
> As Steve D noted when using  dd if=/dev/sda of /dev/sdb the output disk
> must
> be at least as large as the input disk. I have found that the inevitable
> few
> blocks difference in size, in 73GB, is enough to stop this working. I seem
> to remember, that on occasions, there were problems with bad block
> information.
>
> Regarding using "cp" I had understood (possibly wrongly) that cp didn't
> always give a perfect copy and that rsync was more reliable.
> Would the cp command be cp -Ra  /dev/sda /dev/sdb   ?
>
> I have found with proprietary disk copying programs that I get problems
> when
> I upgrade/replace the hardware.
>
> I will look at the other options suggested.
> Once again thanks for the advice and I welcome any more comments or
> suggestions.
>
> Brendan
>
> ----- Original Message -----
> From: <linux at oneandoneis2.org>
> To: <sussex at mailman.lug.org.uk>
> Sent: Monday, November 13, 2006 5:19 PM
> Subject: Re: [Sussex] Simple cloning
>
>
> > > Does the following approach look sensible:
> > >
> > > 1. Install a virgin copy of FC5 on the target disk.
> > >
> > > 2. Place the original drive in the server with a low address.
> > >
> > > 3. Place the target drive in the server with a higher address.
> > >
> > > 4. Boot the system and allow to settle down.
> > >
> > > 5. rsync /dev/sda /dev/sdb    is this too simplistic?  Should I repeat
> > > this step a couple of times.
> > >
> > > 6. Shutdown
> > >
> > > 7. Reboot with only the target drive installed and check that all is
> well.
> >
> > Can't you just use "cp -Ra" for this? It's all I've ever used to move an
> > install from one disk to another. .
> >
> > Dominic
> >
> > __
> > Sussex mailing list
> > Sussex at mailman.lug.org.uk
> > E-mail Address: sussex at mailman.lug.org.uk
> > Sussex LUG Website: http://www.sussex.lug.org.uk/
> > https://mailman.lug.org.uk/mailman/listinfo/sussex
> >
> >
>
>
>
> __
> Sussex mailing list
> Sussex at mailman.lug.org.uk
> E-mail Address: sussex at mailman.lug.org.uk
> Sussex LUG Website: http://www.sussex.lug.org.uk/
> https://mailman.lug.org.uk/mailman/listinfo/sussex
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.lug.org.uk/pipermail/sussex/attachments/20061114/9cf6a1af/attachment.htm 


More information about the Sussex mailing list