Convert Gentoo HVM to PV



Follow these instructions to convert your Xen Gentoo HVM (Fuilly Virtualized) instance to a paravirtalized (PV) instance. This also works for physical machines.

Note that if you've installed a Base Gentoo or other Gentoo PV image, you do not need to follow this guide. You may find the kernel information useful for custom compiling your own Gentoo PV enabled Xen kernel.

Update portage & Install xen-sources

 
emerge --sync
ACCEPT_KEYWORDS="~x86" emerge xen-sources

Configuring the kernel

 
cd /usr/src
rm -rf linux
ln -s linux-2.6.18-xen-r12 linux
cd linux

Note: You may need to do an ls before creating the symlink, and use the appropriate kernel version emerged as it has likely changed.

Grab our pre-built config file for Xen:

 

Gentoo x64 PV

wget www.vr.org/vr_files/gentoo-x64-pv.config

Gentoo i386 PV

wget www.vr.org/vr_files/gentoo-i386-pv.config

Next, move the kernel file into place.

mv gentoo-x64-pv.config .config
make menuconfig

Configure with intel newer core2/xeon support, xen frontend options, ext3, and other defaults

Compile the kernel

make && make modules_install

Install the kernel

cp arch/x86_64/boot/vmlinuz /boot/kernel-2.6.18-xen-r12-vr.org

Next, you need to add a new kernel entry. It's critical not to just replace your existing kernel, so that you can roll back if needed.

vi /boot/grub/menu.cnf 

title Gentoo Linux PV
root (hd0,0)
kernel /boot/kernel-2.6.18-xen-r12-vr.org root=/dev/sda3

Note: you may need to change version numbers, as well as how your drive is represented to your VM (See Dashboard > Options) as appropriate.

Xenify the system

/etc/securetty

tty
xvc0

 

/etc/inittab

 

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

 

/etc/make.conf

 

CFLAGS="-O2 -march=i686 -pipe -mno-tls-direct-seg-refs"

 

Change instance type to PV

 

  1. Log into our portal.
  2. Select options for the instance and scroll down to advanced options.
  3. Select PV-GRUB32 (or 64) depending on your architecture.
  4. Submit the option and leave the default settings.

Go live


The moment of truth. Shut down your server from our portal by doing a full shutdown. Once the instance is down, start it. It should boot using the PV kernel. If it doesn't come back, you can use VNC to troubleshoot, or boot into rescue mode to revert to your old kernel.