Migrate CentOS 5.4 to Ovirt

From Michael's Information Zone
Jump to navigation Jump to search

Purpose

A very old install of CentOS 5.4 needed to be migrated to an Ovirt Hypervisor. This was a special install of Hylafax, a productions server that could not be taken offline, and was critical to business operations.

Several attempts were made to replicate the server and it's 500GB of data. Including running a disk dump over ssh to the destination VM and another physical server.

Steps

My final idea was to rsync the system to the new VM disk, install grub, then go from there.

Rsync

First I created a VM in Ovirt with a disk large enough to hold the data, plus extra as the existing server was running out of space.
After that was completed I

  • booted off a live fedora ISO
  • ran fdisk
    • created first partition with enough space for the boot partition.
    • created second partition with rest of space.
  • started sshd
  • created a password for liveuser
  • On the old server, ran ssh-copy-id liveuser@newvm to ensure key based ssh was setup.

rsync boot partition

While still in the live fedora shell

  • mount /dev/sda1 on /mnt
  • chown liveuser /mnt

Then on the old server ran the following dry run to check for errors.

rsync -avn /boot/* liveuser@newvm:/mnt/ &> rsync.log

Then the live transfer

rsync -avz /boot/* liveuser@newvm:/mnt/ &> rsync.log

rsync root partition

Back in the line fedora shell

  • umount the last partition used for the boot partition on /mnt
  • mount the other partition created (mount /dev/sda2 /mnt)
  • chown liveuser /mnt (shouldn't be needed, just in case).

Then on the old server I ran the following dry run to check for errors and loops. Making sure to exclude the boot partition we already replicated.

rsync -avn --exclude=\/boot / liveuser@newvm:/mnt/ &> rsynctest2.log &
disown
  • Every so often I would check to make sure this was still running. Again, this was 500GB of small files on old mechanical disks.
  • The next morning things looked good, so we went for a live migration. This time adding a nice value of +10 to ensure the replication did not impact system performance during production.
nice rsync -avz --exclude=\/boot / liveuser@newvm:/mnt/ &> rsynctest.log &
disown
  • After a day or so this finished without any strange errors, beyond the expected "files disappeared" that you would get from replicating a live system.