[kwlug-disc] Cloning a physical server

Khalid Baheyeldin kb at 2bits.com
Tue Jul 20 18:25:37 EDT 2010


On Tue, Jul 20, 2010 at 5:53 PM, John Van Ostrand <john at netdirect.ca> wrote:

> Sounds like an easy and successful operation.
>
Yes, easy but time consuming, since the process had to write ~ 100GB and
read them back and write them too.

> My usual routine for this is using network transfer. It all depends on the
> size of data and what other faster paths of transfer exist.
>
I was thinking of using rsync or cpio -p, or scp -ax, but the decision to
use dump/restore is that it is the only method I know that preserves files
as they are and does not modify the access time for them.

> I boot a live cd or a rescue CD (in Red Hat parlance) and manually
> partition, LVM, mkfs, and mount.
>
Using a rescue CD is best, since the target filesystem is not active. I just
took a risk here, and because only ssh is active on the newly installed
server, there is not much activity on the files, so it worked well. Beware
on systems having activity on the file system.

I forgot to mention that i shut down all daemons before creating the dump on
the old server (apache, mysql, munin, nagios, nfs, samba, ...etc.)

> Then I bring up the network and use ssh to transfer the files in a one shot
> command:
>
> cd /mount_point_of_disk
> ssh remote_host "cd / && tar -cvlf - . tmp usr var home boot" | tar -xvf -
>
That works.

Using dump/restore instead of tar would be best for access times though.

Both support user at host:/file, but from a quick look at the man page, I
understood that /file has to be a remote backup device (e.g. tape). Did not
find a way to make it pipe to remote host where restore would suck from the
same pipe. I had to proceed for the sake of time rather than keep
researching this. Perhaps a simple socket would have worked. I did not test
that.

> Then fix up the fstab and grub config and run grub-install. If a new kernel
> was needed I could install it before the transfer. If new drivers are needed
> I usually do that manually on the target server.
>
> I usually forget to de-configure ethernet MAC addresses and do that
> manually on the console at boot.
>
> While the target server reboots I re-IP the old server.
>
Haven't rebooted/reconnected the old one yet. Need space for it and power
before I can do that, then repurpose it for other work.

> If I'm concerned about a consistent backup I'll shut down everything but
> net and ssh on the old server.
>
> I have only found dump/restor useful when I transfer software that uses a
> file's inode as part of a licensing algorithm. Using dump/restor ensures the
> same inodes for files.
>
Good to know that trick ...

> ------------------------------
>
>
-- 
Khalid M. Baheyeldin
2bits.com, Inc.
http://2bits.com
Drupal optimization, development, customization and consulting.
Simplicity is prerequisite for reliability. --  Edsger W.Dijkstra
Simplicity is the ultimate sophistication. --   Leonardo da Vinci
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://kwlug.org/pipermail/kwlug-disc_kwlug.org/attachments/20100720/9c9d7273/attachment.htm>


More information about the kwlug-disc mailing list