Difference between revisions of "Migrate CentOS 5.4 to Ovirt"

From Michael's Information Zone
Jump to navigation Jump to search
Line 14: Line 14:
 
**created first partition with enough space for the boot partition.
 
**created first partition with enough space for the boot partition.
 
**created second partition with rest of space.
 
**created second partition with rest of space.
 +
*Formatted both partitions as ext3, same as the old server.
 
*started sshd
 
*started sshd
 
*created a password for liveuser
 
*created a password for liveuser
Line 46: Line 47:
 
</pre>
 
</pre>
 
*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.
 
*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.
 +
===Installing and fixing grub===
 +
This was the part that took the most time. For this part I
 +
*Booted the VM from a CentOS 7 minimal install ISO.
 +
*Jumped to the rescue shell. At this point it did not find any linux volumes, which was something I had seen after performing the disk dump.
 +
*Ran fdsik to verify the partitions, unlike the disk dump I was able to see the two volumes I had created previously. PROGRESS!
 +
*mounted both partitions as follows
 +
**mount /dev/sda2 /mnt/sysimage
 +
**mount /dev/sda1 /mnt/sysimage/boot
 +
*chroot /mnt/sysimage

Revision as of 18:00, 16 June 2018

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.
  • Formatted both partitions as ext3, same as the old server.
  • 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.

Installing and fixing grub

This was the part that took the most time. For this part I

  • Booted the VM from a CentOS 7 minimal install ISO.
  • Jumped to the rescue shell. At this point it did not find any linux volumes, which was something I had seen after performing the disk dump.
  • Ran fdsik to verify the partitions, unlike the disk dump I was able to see the two volumes I had created previously. PROGRESS!
  • mounted both partitions as follows
    • mount /dev/sda2 /mnt/sysimage
    • mount /dev/sda1 /mnt/sysimage/boot
  • chroot /mnt/sysimage