Converting HVM domU into paravirtualised one

From MyWiki

Jump to: navigation, search

Main source of the conversion information came from pastebin.

First thing I used RHEL 4 installation DVD to get HVM domU installed. Here is the domU's configuration file I used:

name = "rhel4_pxe"
kernel = "/boot/vmlinuz-xen-install"
ramdisk = "/boot/initrd-xen-install" 
builder="hvm"
device_model="/usr/lib64/xen/bin/qemu-dm"
kernel="/usr/lib/xen/boot/hvmloader"
memory = 512
disk = [ 'phy:/dev/rootvg_dom0/rhel4_domU_pxe,hda,w', 'file:/tmp/RHEL4-U8-re20090504.0-i386-ES-DVD-ftp.iso,hdc:cdrom,r', ]
boot = "cd"
vif = [ 'bridge=br120' ]
vcpus = 1
localtime = 0
on_poweroff = 'destroy'
on_reboot = 'restart'
on_crash = 'destroy'
vnc = "1"
vnclisten = "172.xx.xx.181"

After the installation was over, I needed to convert the HVM image into a PV one. Since I had the boot order as 'hard disk; CD' (boot = "cd"), I had to change nothing in the above mentioned domU configuration file.

So, I booted the HVM domU and did the following:

1) installed kernel-xenU-2.6.9-89.EL package

2) made copy and re-built initrd image

  # ls /boot/initrd-2.6.9-89.EL*
  # cd /boot
  # mv initrd-2.6.9-89.ELxenU.img initrd-2.6.9-89.ELxenU.img.bak
  # mkinitrd -v --builtin=xen_vbd --preload=xenblk initrd-2.6.9-89.ELxenU.img 2.6.9-89.ELxenU

3) changed /etc/modprobe.conf. Commented the line that was there (8139cp) and added two more for Xen block device driver and Xen network device driver:

#alias eth0 8139cp
alias eth0 xennet
alias scsi_hostadapter xenblk

4) added xvc0 to the end of /etc/securetty

5) added the following line to /etc/inittab (make sure you don't have it there already! Otherwise you are going to have some gremlins switching you consoles all the time):

co:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav

6) shutdown the HVM domU and created new domU configuration file to run it as PV:

name = "rhel4_pvm"
memory = 512
disk = [ 'phy:/dev/rootvg_dom0/rhel4_domU_pvm,xvda,w' ]
vif = [ 'bridge=br120' ]
vcpus = 1
builder = 'linux'
bootloader = '/usr/bin/pygrub'
localtime = 0
on_poweroff = 'destroy'
on_reboot = 'restart'
on_crash = 'destroy'

That was it. Pretty simple when you know how :-)

Personal tools