Posted: Mon Sep 02, 2013 8:19 pm Post subject: migration from one server to another one

Hello,
Since some time I have one server with an updated gentoo OS, the user folders, some services, a website and so on.
Now I'm getting an other server with exactly the same hardware (except for the RAM memory, which is doubled on the new one).

My intention would be to copy the whole disk from the old server to the new one, but the problem is that I cannot physically access the servers, I can only control them via SSH so I probably need some tricks in order to be able to copy the whole system and overwrite on the new system all the files, included those that should be in use.

after do this on the new server : ssh root@oldserver "cat /dev/sda" > /dev/sda
repeat it for all hard drive you have.

Iksch!? You shouldn't do that.
If the drives aren't exactly to the point the same, you'll just end up with a damaged partition table! -And I've seen brand new servers that had 6 sas disks locally from one vendor in it, but half of them were from a different series with a slightly different disk layout...
It is also much faster and more flexible if you just take the part that is actually in use...
I always do it like this:
1. boot the target from a live media
2. create the partitions, mkfs and mount them somewhere
3. watch out that /boot is mounted on the source machine
4. rsync -urlvopgtD --exclude=/sys/* --exclude=/proc/* root@source-machine:/* /target/mountpoint/
5. write the bootloader
6. delete /etc/udev/rules.d/70-persistent-net-rules and adjust /etc/conf.d/net as well as probably fstab and the hostname
7. unmount and reboot

I would have packed all the server (OS and data) into stage4 archive, moved it to new hardware and unpacked it.
Since you have ssh access only, it is better to move packed archive rather than move non-packed raw data over the net.

I could do a stage 4 archive and unpack it on the new system, but what would happen to the in-use files?
I would surely overwrite some of them in the unpacking process. Isn't it important? Can I proceed anyway?

Hello nativemad,
unfortunately I'm not able to boot on a live media, otherwise it would be easy to simply live-mount both hard drives and copy from the old one to the new one.