[CentOS] Best way to duplicate a live Centos 5 server?

Mon Jun 18 16:21:15 UTC 2012
Cal Sawyer <cal-s at blue-bolt.com>

From: Les Mikesell <lesmikesell at gmail.com>
Subject: Re: [CentOS] Best way to duplicate a live Centos 5 server?
To: CentOS mailing list <centos at centos.org>

On Fri, Jun 8, 2012 at 12:04 PM, Scott Silva <ssilva at sgvwater.com> wrote:

>>     Am I missing something glaringly obvious here, or is the only way I'm
>>     going be able to migrate is to shutdown the C5 server for a few hours
>>     while duping the old drives? Would greatly appreciate any pointers how
>>     best to do this.
>     You could always rsync the old server to the new one... a few runs will get
>     99% of the files, and a quick run after the shutdown can get the rest... Have
>     a tar file ready of the needed config changes ready and untar it and start up
>     the new system...
    An interesting variation on this is to use 'ReaR' to back up and
    restore the machine, essentially cloning it but give the copy a
    different IP address as you bring it up.  Then when the clone is close
    to ready to take over, shut down your apps for the time it takes a
    final rsync to fix up the differences (in the data areas only - avoid
    /etc/, (etc.), then switch the IP.

    ReaR is in active development now and is very usable.  It is a set of
    shell scripts designed to run live backups that are capable of
    restoring to bare metal.   It makes a new boot iso with tools from the
    running system to reconstruct the filesystem (including lvm/raid,
    etc.) and restore on top of that.   Several backup methods are
    supported but tar to an nfs location is probably the easiest to set
    up.  With a small amount of extra work you can tweak the filesystem
    layout, etc. if you don't want an exact clone.  With hardware
    differences you might need to tweak modules and build a new initrd,
    too.  ReaR is packaged in EPEL as rear.

ReaR has suddenly become very interesting to me, probably explaining why
it utterly fails to work properly (for me).I'm using 1.13 to pull a
USB-based recovery image, but there's an error in the
backup/NETFS/default/50_make_backup.sh script that doesn't mount the USB
device after the mkrecovery step, so subsequent tar fails on write to
the non-existent mountpoint. I fixed that, but on recovery it fails to
mount the necessary directories on the restore drive as well, so "rear
recover" quickly bombs out. Is anyone having any success actually using
ReaR on CentOS 6.x? - csawyer