I have a server I’ve been using which does not have hardware virtualisaton (HVM). On this I’ve been using Xen paravirtualisation (PVM). This is all well and good, except the server is approaching six years old and I’ve a shiney new server that does support HVM that I’d like to use.
Warning: Acronym overload ahead…
Given that the virtual machines (VM), in Xen parlance these are known as DomU, are not going to change I thought it easier to try and migrate the hosts over one by one.
They are all running Debian, though not all the same version nor the same architecture (i386/amd64). Some are running Lenny rather than Squeeze and I don’t want to force myself to upgrade just yet.
The plan of action. This is a plan, not exact details. I’ll probably add them in blow
- Create a logical volume (LV) on the host with LVM to contain all of the VM disk space.
- Create a “test” VM. This is required as I’m going to create an LVM volume group (VG) within the LV I just created, and I seem unable to do this on the host. I could be wrong about that
- Add the VM LV as a secondary disk to the “test” VM & start the “test” VM
- On the VM disk create two partitions. One 500Mb (for /boot) and one containing the rest for LVM.
- Create LV paritions for / /var /usr & /home as neccessary. Mount in the usual file structure
- Stop services on the source machine (except SSH obviously) and rsync files over SSH
- Modify files as neccessary (such as /etc/fstab) to accomodate changes
- Chroot to the mount point and install LVM2 if not installed.
- Shut down “test” VM
- Create VM for the copied machine and include the KVM host’s kernel & initrd. This will allow it to boot as Xen PVMs do not have a kernel or Grub
- Start the KVM, all should boot okay if you updated. This will fail if LVM2 package is not installed
- Install a kernel and Grub. Shut down the VM
- Remove the KVM hosts kernel & initrd and start the VM It should boot Grub in the VM and all should be well
I expect to add a more detailed description on this later.