Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set boot order on KVM (libvirt/virsh)?

How would you set the boot order on KVM when using libvirt/virsh? (Either via config or command)

like image 931
Bravo Delta Avatar asked Sep 25 '13 17:09

Bravo Delta


People also ask

How do I change the boot order in QEMU?

A simple way to set this order is to use the -boot order= option, but you can also do this more flexibly, by setting a bootindex property on the individual block or net devices you specify on the QEMU command line.

What is libvirt in KVM?

libvirt is an open-source API, daemon and management tool for managing platform virtualization. It can be used to manage KVM, Xen, VMware ESXi, QEMU and other virtualization technologies. These APIs are widely used in the orchestration layer of hypervisors in the development of a cloud-based solution.

Where is libvirt config?

libvirt stores it's configuration as xml in '/etc/libvirt/qemu'. The xml is easy to understand, and is similar to VMware *.


1 Answers

Please take a look at the section Operation System booting.

The most common option is the BIOS bootloader where it allows you specifying boot order via changing domain XML. try command virsh edit <your-domain-name> then adjust the boot order with this example (copied from libvirt.org):

<os>
  <type>hvm</type>
  <loader>/usr/lib/xen/boot/hvmloader</loader>
  <boot dev='network'/>
  <boot dev='cdrom'/>
  <boot dev='hd'/>
  <bootmenu enable='yes'/>
</os>

Which means the boot order is:

  1. boot from network like PXE boot
  2. boot from CD-ROM if no PXE boot
  3. boot from local hard disk if no PXE boot nor bootable CD
like image 190
shawnzhu Avatar answered Oct 02 '22 17:10

shawnzhu