Setting boot order for domUs

From Xen
Revision as of 15:58, 28 June 2014 by Florianheigl (talk | contribs)
Jump to navigationJump to search

How to change the boot order (boot sequence) in Xen PV and HVM guests.

HVM guests

Use the boot parameter:

# boot on floppy (a), hard disk (c), Network (n) or CD-ROM (d)
# default: hard disk, cd-rom, floppy
boot="cda"

Put the letters in order from left to right, the drive corresponding to the first letter on the left is going to be the one that boots first. For example if you want to boot from cd-rom first, then from the network and lastly from the hard-disk, this is what you need to set your boot parameter to:

boot="dnc"


PV guests

PV guests don't run in an fully emulated environment like HVM guests. As a consequence they cannot boot from the network (pxeboot) or from a cdrom. They can however boot from a user provided kernel or from one of the kernels installed in the VM disk image.

boot from a user specified kernel

You just need to pass the right kernel and initrd parameters:

# Kernel image to boot
kernel = "/boot/vmlinuz"

# Ramdisk (optional)
ramdisk = "/boot/initrd.gz"

You can also pass an extra parameter to specify the kernel command line, that allows you to choose the root disk:

# Kernel command line options
extra = "root=/dev/xvda1"

boot from a kernel installed in the VM disk

You need to add the following two lines to the VM config file:

bootloader = '/usr/bin/pygrub'
extra = "(hd0)/boot/grub/menu.lst"

Make sure you pass -c to xl create to connect to the guest's console right away.


network boot solutions and workarounds

You can use Xenpvnetboot.

The older solution for this is pypxeboot, which can be found i.e. here: https://github.com/blamarvt/pypxeboot


Otherwise you can write yourself a simple wrapper script that:

  • gets the kernel and initrd from the network;
  • updates the kernel and initrd parameters in the VM config file;
  • calls 'xl create config-file.