Setting boot order for domUs

From Xen
Revision as of 14:52, 24 September 2012 by StefanoStabellini (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:

  1. boot on floppy (a), hard disk (c), Network (n) or CD-ROM (d)
  2. 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:

  1. Kernel image to boot

kernel = "/boot/vmlinuz"

  1. 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:

  1. 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"


workarounds for network boot

You can write 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.