Home > Network Administrator > “Converting HVM to PV – Ubuntu using XenCitrix”

“Converting HVM to PV – Ubuntu using XenCitrix”

“Converting HVM to PV in Ubuntu”

1.Create a new VM using the following steps through XenCenter.
a)In Template, Select “Other installation Media”
b)Give a “Server name”
c)In Installation Media, select “Install from ISO library or DVD” >> Select “Ubuntu_10.10_mini.iso”
d)Assign Memory, Disk Space, CPU’s and Network Card to the server.

2.Once the VM is created, goto the “Properties” >> “ Startup Options” of the VM and change the boot order in such a way to make the VM boot from the DVD.

3.Reboot the VM, the VM will be booting from the DVD drive.

4.Hit on the “Install” option in the Ubuntu boot screen.

5.Select Language, Keyboard Layout etc.

6.On Network configuration wizard, Select “Manual Network Configuration”

7.Assign an IP address, proper Gateway, subnet and resolvers.

8.You will be asked to select a mirror inorder to download the packages for installation Select a mirror. It will take some time to download the archives.

9.During Partitioning, Select “ Manual/Custom System partition” .

10.Create only 2 partitions. “/” and “SWAP”

11.Proceed the installation with the new parttion table.

12.You will be asked to select certain softwares during installation. Make sure that you have selected “OpenSSH” and anyother software which you requires.

13.Once the installation installation is completed, remove the DVD from the drive and boot the server.

14.Enter in to the server with the password and username that you have created during the installation process.

15.You will now be able to access the server through ssh.

16.Connect to the VM via SSH

17.Install Vim “apt-get install vim”

18.Duplicate /etc/init/tty1.conf to create a new console for Xen.

cp /etc/init/tty1.conf /etc/init/hvc0.conf

19.Change tty1 to hvc0 in “/etc/init/hvc0.conf”

20.Cat /boot/grub/grub.cfg file and note down the following parameters.

linux /boot/vmlinuz-2.6.35-27-generic root=UUID=ab23d8ad-66e5-4588-9657-fb4cbd11ba07 ro splash quiet
initrd /boot/initrd.img-2.6.35-27-generic


Kernel path: /boot/vmlinuz-2.6.35-27-generic

Ramdisk path: /boot/initrd.img-2.6.35-27-generic

Kernel arguments: root=UUID=ab23d8ad-66e5-4588-9657-fb4cbd11ba07 ro splash quiet

21.Please confirm the above parameters, since you need to use it during the Conversion.

22.Shutdown the VM

23.Now login to the Hardware node where the VM resides. We have some steps to be done here now.

24.Copy the following script to “makepv.sh” in /root.

confirm() {
echo -n "$1 OK [Y/n]?"
if [ "$ANSWER" == "y" ] || [ "$ANSWER" == "Y" ] || [ -z "$ANSWER" ]
eval $1
echo "...parameter set"
echo "...parameter NOT set"
if [ -z $1 ]
echo -n "Name of VM [l for list]: "
read VM
if [ "$VM" == "l" ] || [ "$VM" == "L" ]
xe vm-list | grep name-label | grep -v "Control domain"
echo ""
echo "Looking up UUID for VM $VM"
UUID=$(xe vm-list name-label=$VM params=uuid --minimal)
if [ -z $UUID ]
echo "No UUID found for $VM."
exit 0
echo ""
echo "UUID=$UUID"
echo ""
echo "Setting parameters for VM $VM"
confirm "xe vm-param-set uuid=$UUID HVM-boot-policy="
confirm "xe vm-param-set uuid=$UUID PV-bootloader=pygrub"
echo ""
echo -n "Specify path to Kernel (e.g. /boot/vmlinuz...): "
echo ""
echo -n "Specify Kernel arguments (root=UUID=... ro quiet): "
echo ""
echo -n "Specify path to ramdisk (e.g. /boot/initrd...): "
echo ""
confirm "xe vm-param-set uuid=$UUID PV-bootloader-args=\"--kernel=$KERNEL_PATH --ramdisk=$RAMDISK_PATH\""
echo ""
confirm "xe vm-param-set uuid=$UUID PV-args=\"$KERNEL_ARGS console=hvc0 xencons=hvc0\""
echo ""
echo "List of discs for VM $VM"
xe vm-disk-list uuid=$UUID
echo ""
echo "Looking up UUID for VBD of VM $VM"
VBD=$(xe vm-disk-list uuid=$UUID | grep -A1 VBD | tail -n 1 | cut -f2 -d: | sed "s/ *//g")
if [ -z $VBD ]
echo "No VBD UUID found for $VBD."
exit 0
echo "VBD UUID=$VBD"
echo ""
echo "Setting parameters for VBD $VBD"
confirm "xe vbd-param-set uuid=$VBD bootable=true"
exit 0

25.Make the script excecutable. Chmod 755 makepv.sh

26.run the script with your Vmname as argument.

./makepv.sh testvm

27.You will be asked for the parameters that we have noted from the grub.cfg file. Please provide the same.

28.Also, you will be asked for confirmation. Hit “Y” whenever you are asked for confirmation.

29. Once completed, boot the VM.

30.Now put the iso image labeled “xentools.iso” in the DVD drive of the server through Xen citrix.

31.Mount the drive through VM. Ssh to the VM and mount the iso image using the following command.

mount /dev/disk/by-label/XenServer\\x20Tools /mnt

32. Goto the directory named “Linux”

cd Linux

33. You can find a debian packages named the following:


34.Choose the one that matches your VM architecture.

35.Install it using the command

dpkg -i xe-guest-utilities_5.6.100-647_amd64.deb

36.Reboot the serverv once it is completed.

37.Login to the VM and fix the service so it runs at boot:

update-rc.d -f xe-linux-distribution remove
update-rc.d xe-linux-distribution defaults

38.An easier method to check whether the VM is HVM or PV is to check the boot options. HVM supports network boot, DVD and HDD boot. Whereas PV supports only DVD or HDD boot.

39.You can check it through VM >> “Properties” >> “Startup Options”

Categories: Network Administrator
  1. rogerio
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: