reloca.toby XServer

reloca.to/Guides

Moving an old CentOS 7 server

It has been running for years, it is past its end of life, and everybody is afraid of it. That is exactly the server this tool was written for: it moves the system as it is, without touching what makes it work.

Move first, upgrade later

An old server is frightening because two risky operations get mixed into one evening: moving it and modernising it. Separate them. The move copies the system unchanged, down to the kernel and the SELinux policy, and the only things that differ afterwards are the controller drivers, the bootloader and the interface name. Whatever you were going to upgrade can wait until the system is on hardware you control, with the old machine still sitting there as a rollback.

What is different about CentOS 7

  • The 3.10 kernel has no usable eBPF. For an on-line move the agent needs to know which blocks changed, so on this kernel it watches writes through ftrace instead. It is slower than eBPF and it works; both are tested on CentOS 7.9 end to end.
  • The tooling is old. Its lsblk from util-linux 2.23 refuses half the columns a modern one answers, so the inventory asks for what this version has and fills the rest from blkid and the raw partition table.
  • SELinux stays enforcing. The filesystems travel with their labels, so nothing has to be relabelled and nothing is switched to permissive behind your back.
  • grub2, not grub-legacy. CentOS 7 is fine. CentOS 6 and anything else on grub-legacy is not supported, and the plan says so instead of trying.

The one thing to check in advance

If the move also changes the firmware, UEFI to BIOS or back, the fix-up has to install the other grub2 package inside the copy, with the system's own package manager. CentOS 7 mirrors are gone, so a machine whose repository files still point at mirror.centos.org cannot install anything at all. Point them at vault.centos.org before you start, or keep the firmware the same and the question does not arise.

Everything else about the migration works offline: no package is installed on the old server, and nothing is downloaded into the copy unless the firmware changes.

The move

Nothing special has to be done on the old server; it can keep running.

ssh -A root@NEW-SERVER
curl -fsSL reloca.to | bash
reloca.to -n root@OLD-IP      # the plan, nothing written
reloca.to root@OLD-IP

Read the plan. On a system this old it is worth a minute: it names every filesystem with its features, every md array and volume group, and what it intends to do with each. If something there surprises you, that surprise was already in the server, and better to meet it now.

After the verify

The verify checks the things an old system gets wrong most often: that the boot entry points at a kernel and an initrd that exist, that the initramfs has the driver for the new controller, that fstab resolves, that the network configuration matches the interface the system will actually have. Exit code 3 means it found a problem and the new server must not be rebooted yet; the old one is still untouched, so there is time.

Once it boots, you have the same CentOS 7 on new hardware, with a rollback that is one power button away. That is the moment to think about upgrading it, and not before.

Every option is in the option reference.

Try it on your own move

The tool is free, the dry run changes nothing, and the old server is only ever read.

curl -fsSL reloca.to | bash

All options