Changing the boot order of a virtual machine on ESXi using virtual machine advanced option
search cancel

Changing the boot order of a virtual machine on ESXi using virtual machine advanced option

book

Article ID: 326326

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

This article provides steps to change the boot device without using the virtual machine's BIOS and its limitation to 8 visible devices.


Environment

VMware vSphere ESXi 5.0
VMware vSphere ESXi 8.0.x
VMware vSphere ESXi 5.1
VMware vSphere ESXi 6.0
VMware vSphere ESXi 6.5
VMware vSphere ESXi 7.0.x
VMware vSphere ESXi 6.7
VMware vSphere ESXi 5.5

Resolution

Option 1 - Configuring the boot order for a virtual machine with on ESXi 6.x / 7.0 or 8.0 using the using the BIOS boot manager:

  1. Shut down the virtual machine.

  2. Click the virtual machine in the Inventory.

  3. Right click Edit Settings.

  4. In the Virtual Machine Properties dialog, click the VM Options tab.

  5. Under Boot Options, select the check box for Force BIOS setup.

  6. Click OK to save the changes.

  7. Power on the virtual machine

  8. Open a VM console and navigate to the BIOS > Boot section

  9. Make your boot order selection and save

     

Option 2 - Configuring the boot order for a virtual machine with legacy BIOS using VM advanced options

You can also choose the boot device using the virtual machine advanced options bios.bootOrder and bios.hddOrder. These settings override the boot order that you might have set in the virtual machine's BIOS previously.

The virtual machine's boot order can be set to any virtual NIC ethernetX, where X is the number of the device. For example, ethernet0 or ethernet5. It can also be set to hdd, cdrom, or floppy. If set to cdrom or floppy there are multiple devices, the virtual machine tries them sequentially until it finds one to boot from. If bios.bootOrder is set to hdd, you also need to define bios.hddOrder and set a device (for example, scsi0:3 or ide1:0) to boot from.

To make this change, ensure that the virtual machine is currently in powered off state, then:

  1. Right-click the VM in vSphere Client.

  2. Select Edit Settings.

  3. In the VM Options tab, select Advanced.

  4. Next to Configuration Parameters, click on EDIT CONFIGURATION.

  5. Select [ADD CONFIGURATION PARAMS] to create the new VM advanced parameters:

For example:
  Name   Value
bios.bootOrder
ethernet5,ethernet2,hdd,cdrom,floppy
bios.hddOrder
scsi2:2,scsi0:1,ide1:0
 
  1. Click [OK], then [OK] again to save the change and exit the VM settings wizard.

You can also configure the list of devices by editing the VMX configuration file. Ensure that the VM is currently powered off for this. When adding the settings in the VMX file, make sure to put the device list(s) into quotation marks and separate the devices with commas.

For example:

bios.bootOrder = "ethernet5,ethernet2,hdd,cdrom,floppy"
bios.hddOrder = "scsi2:2,scsi0:1,ide1:0"

In this example, the virtual machine tries to boot with ethernet5. If there is nothing to boot from, try ethernet2. If that fails, try from the disks (hdd) defined in hddOrder, then all CD-ROMs, and finally from all floppies.

Note: Adding these advanced options can block you from changing the boot order in the BIOS setup. Should you experience this, and wish to be able to use the BIOS to make boot order changes, remove both options while the VM is in powered off state. The next time the VM is powered on, it will use the boot order which was originally configured in the BIOS setup.

 

Option 3 - Configuring the boot order for a virtual machine with either legacy BIOS or EFI using PowerCLI

You can also use PowerCLI to change the boot order for a virtual machine, using a script like the example below. This is the only way to set a persistent boot order for EFI VMs.

This example assumes that you have a VM with a virtual disk and a virtual NIC, and a CDROM, and the VM should boot from the NIC first and then try the virtual CDROM:
$strVMName = "vm-name"
$strBootNICDeviceName = "Network adapter 1"
$strBootHDiskDeviceName = "Hard disk 1"
$viewVM = Get-View -ViewType VirtualMachine -Property Name, Config.Hardware.Device -Filter @{"Name" = "^$strVMName$"}
$intNICDeviceKey = ($viewVM.Config.Hardware.Device | ?{$_.DeviceInfo.Label -eq $strBootNICDeviceName}).Key
$oBootableNIC = New-Object -TypeName VMware.Vim.VirtualMachineBootOptionsBootableEthernetDevice -Property @{"DeviceKey" = $intNICDeviceKey}
$intHDiskDeviceKey = ($viewVM.Config.Hardware.Device | ?{$_.DeviceInfo.Label -eq $strBootHDiskDeviceName}).Key
$oBootableHDisk = New-Object -TypeName VMware.Vim.VirtualMachineBootOptionsBootableDiskDevice -Property @{"DeviceKey" = $intHDiskDeviceKey}
$oBootableCDRom = New-Object -Type VMware.Vim.VirtualMachineBootOptionsBootableCdromDevice
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec -Property @{
    "BootOptions" = New-Object VMware.Vim.VirtualMachineBootOptions -Property @{
        BootOrder = $oBootableNIC, $oBootableCDRom, $oBootableHDisk
    }
}
$viewVM.ReconfigVM_Task($spec)

To verify that the boot order was applied, you can use:
$vm = Get-VM vm-name; $vm.ExtensionData.Config.BootOptions | Select BootOrder

Note: In addition to updating the boot order in the VM extension data, the script will add the 2 advanced settings bios.bootOrder and bios.hddOrder to its .vmx file. As a result you will be blocked from changing the boot order in the BIOS or EFI setup interface. Should you experience this, and wish to be able to use the BIOS to make boot order changes, remove both options while the VM is in powered off state.
The next time the VM is powered on, it will use the boot order which was originally configured in the BIOS setup.
 
 


    Additional Information

    For more information on the bootOrder property in the vSphere API 5.0, see VirtualMachineBootOptions.

    For more information on editing configuration files directly, see Editing configuration files in VMware ESXi and ESX (1017022) and Editing files on an ESX host using vi or nano (1020302).

    Note: The virtual machine needs to be powered off and unregistered (removed from the vCenter Server/ESXi inventory) for the .vmx file to be edited safely.

    When you make changes to the virtual machine configuration file, register it back with the vCenter Server/ESXi inventory following Registering a virtual machine with the vSphere Web Client (2032904).

    To be alerted when this document is updated, click the Subscribe to Article link in the Actions box
    Editing configuration files in VMware ESXi and ESX
    Editing files on an ESX host using vi or nano
    Registering a virtual machine with the vSphere Web Client
    使用 vmx 选项更改虚拟机的引导顺序
    vmx オプションを使用した仮想マシンの起動順序の変更

    Impact/Risks:

    Note: The settings in this article override the boot order configuration in the BIOS. When you add these settings, changing the boot order in the virtual machine BIOS will be blocked. Therefore to use the BIOS UI for changing the boot order, you will need to remove the bios.bootOrder and bios.hddOrder if they exist.