After wading through complicated and poorly organized how-to’s for converting a XenServer HVM domain to PV (paravirtual), I wrote a quick and dirty tool to make the conversion in both directions. I was able to get Debian Lenny 5.0.8 paravirtual domain running without any issues. All memory, CPU, disk, and network stats shows up perfectly in XenCenter, too!
[root@vps1a ~]# ./vmtool.pl Usage: vmtool.pl --cmd (hvmtopv|pvtohvm) ([--vm name-label] or [--uuid uuid]) [--root partition_num]
Here’s an example of it running:
[root@vps1a ~]# ./vmtool.pl --cmd=hvmtopv --vm=c1068vm1 uuid = 7cf68fa6-3d07-0869-fa2d-40c89a724042 cmd = hvmtopv Changing HVM-boot-policy Changing PV-args Setting disk boot flag ***Please update /etc/fstab, /etc/inittab. then reboot VM Done.
If your root partition is anywhere except the 1st partition on the virtual disk, specify the partition number with the –root argument.
To reverse the process, change the –cmd argument from ‘hvmtopv’ to ‘pvtohvm’.
PV domains can be made into templates within XenCenter, so you don’t have to run the script all the time.
Here are steps to take on your domain after changingtour HVM domain to PV. Make sure to complete these steps (except 4) in HVM mode before rebooting. After the reboot, you can install the Xen tools and reboot again.
1. Install a Xen-aware kernel and make it the default boot option in grub.conf or menu.lst.
2. Update /etc/fstab entries – Example: replace /dev/hda1 with /dev/xvda1, /dev/hdd with /dev/xvdd, ect.
3. Update /etc/inittab – Example: replace tty1 with hvc0 so that the Console works properly
4. Make sure the /boot or / partition (depending on your partition layout) has the boot flag set. THIS IS IMPORTANT!
5. Install the Xen tools from the xs-tools CD so that memory, disk, and network usage appears properly in XenCenter
Get the script here:
It’s a shame that XenServer still caters to the Windows crowd by making HVM domains the default, with no way to easily switch to PV. Hopefully this script makes life easier for someone.