Posts Tagged ‘Ubuntu’

Setting up a Ubuntu 12.04 Guest as HVM, Converting it to PV

With Ubuntu 12.04 it’s remarkably simple to convert a HVM guest to PV. This will probably work in much the same way with Ubuntu 12.10 as well. Here’s what i did:

Requirements

  • VM Host running Xen 4.1 or later (mine is running the default packages provided by debian 6 / squeeze)
  • A spare drive (will also work with a disk-image-file)
  • Ubuntu Server installation ISO

Installation Phase

In the installation phase, i am running this machine as a HVM machine. The config can be found below. I basically give it a hard disc and the CD-ISO as disks and tell it to boot from CD. Everything else is pretty much default.

# Hostname
name    = 'machine'

# HVM-Loader.
kernel  = '/usr/lib/xen-4.0/boot/hvmloader'
device_model='/usr/lib/xen-4.0/bin/qemu-dm'
builder = 'hvm'

memory  = 2048
shadow_memory = 8
vcpus   = 2

disk    = [
           'phy:/dev/sdc,ioemu:hda,w',
           'phy:/dev/loop21,ioemu:hdc:cdrom,r' # i need to loop CD-Isos, not sure, why.
          ]

#  Networking
vif         = [ 'mac=11:22:33:44:55:66,bridge=br0' ]

boot='d'
vnc=1
vncpasswd = 'setup-something-nice'

Fire up your machine with xm create machine.cfg and connect to it via VNC. Install Ubuntu the way you like.

Converting to PV

After the setup, i usually turn the machine off and mount the hard-disk on the VM host. I alter two things: I add a /etc/init/hvc0.conf (which is a copy from /etc/init/tty1.conf with slight alterations) and i put some static settings into /etc/network/interfaces.

I then reboot the machine with this Xen-Config:

name        = 'machine'
kernel      = '/boot/vmlinuz-3.2.0-31-generic'
ramdisk     = '/boot/initrd.img-3.2.0-31-generic'
root        = '/dev/xvda1 ro,console=hvc0'

memory      = '2048'
vcpus       = '2'

disk        = [
                'phy:/dev/sdc,xvda,w'
              ]

vif         = [ 'mac=11:22:33:44:55:66,bridge=br0' ]

on_poweroff = 'destroy'
on_reboot   = 'restart'
on_crash    = 'restart'


Author

Claudius Coenen is a tech-enthusiast. He's writing on all kinds of topics, including programming, technology, gadgets and media.

This site features his occasional articles, findings, documentations.

Categories

Connect

RSS Recent Bookmarks

Legal