|

After a very long absence, Changing Linux HVM to PV on Xen

I have had a stressed time, and had no time to actually write down anything here. This is pity, since I have been doing so many things worth sharing.
I will start with a small one now – how to convert a physical machine into Xen-based VM. I assume you know the drill of how to do P2V in whatever method you like. My preferred method is of booting into a new system (virtual) and then manually building the partitions, LVM, etc, and using ‘tar’ with ‘nc’ to copy files from the source server to the target server. I might elaborate more about it some time, but this post is about the next phase – We have now previously physical server which used to use /dev/sdX or /dev/cciss/cXdXpX, or whatever else, and we need to make it Xen-friendly.
This procedure will apply to RedHat’s Xen-based virtualization, OracleVM or Citrix XenServer.
I assume that the target system maintains LVM settings and mount points as the original one.
These are the steps that need to be performed, manually.
I used CactiEZ image, installed as HVM on Citrix XenServer as my example. This procedure should apply to all Linux systems, with respect to their package manager.

Edit /etc/modprobe.conf

Change eth0,1,whatever alias to xennet

Change/add alias of scsi_hostadapter to xenblk

Edit /etc/blkid.tab

Run the command

sed -i ‘s/hd/xvd/g’ /etc/blkid.tab

to change references if you use labels. These will be used by rc.sysinit later during boot sequence, and we need them configured correctly.

Get Paravirtualized Kernel

yum install kernel-xenU

Edit /etc/securetty

Add the line “xvc0” to it. Notice, it’s zero and not ‘o’

Edit /etc/inittab

Replace tty1 with xvc0

Edit /boot/grub/menu.lst

Change the default entry to be the one with the xenU kernel

Replace ‘/dev/sda’ with ‘/dev/xvda’

Edit /boot/grub/device.map

Replace ‘/dev/sda’ with ‘/dev/xvda’

Edit /etc/fstab

Verify labels are used (and then – see changes to blkid.tab above), or devices are renamed to xvd[a-z]

Reboot into PV-enabled VM

This should do it. The VM will attempt to detect new hardware, network MAC changes, etc, but it will work fine.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.