Setting boot order for domUs: Difference between revisions

From Xen
Jump to navigationJump to search
No edit summary
No edit summary
Line 4: Line 4:
Use the '''boot''' parameter:
Use the '''boot''' parameter:


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


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


<code>
<pre>
boot="dnc"
boot="dnc"
</code>
</pre>




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


<code>
<pre>
# Kernel image to boot
# Kernel image to boot
kernel = "/boot/vmlinuz"
kernel = "/boot/vmlinuz"
Line 31: Line 31:
# Ramdisk (optional)
# Ramdisk (optional)
ramdisk = "/boot/initrd.gz"
ramdisk = "/boot/initrd.gz"
</code>
</pre>


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


<code>
<pre>
# Kernel command line options
# Kernel command line options
extra = "root=/dev/xvda1"
extra = "root=/dev/xvda1"
</code>
</pre>


=== boot from a kernel installed in the VM disk ===
=== boot from a kernel installed in the VM disk ===
You need to add the following two lines to the VM config file:
You need to add the following two lines to the VM config file:


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


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



=== workarounds for network boot ===
=== network boot solutions and workarounds ===
You can write a simple wrapper script that:
You can use [[Xenpvnetboot_:_A_network_bootloader_for_Xen_PV_guest|Xenpvnetboot]].

Otherwise you can write yourself a simple wrapper script that:


* gets the kernel and initrd from the network;
* gets the kernel and initrd from the network;

Revision as of 15:06, 24 September 2012

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.

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.