XenServer-UEFIVM
Jump To: Support > KB > Citrix > XenServer > UEFIVM
Convert existing VM to UEFI boot
- Power down the VM
- Note the name of the system disk (add description or rename if it is the same as another disk on the same storage)
- Detach its system disk
- Boot a conversion VM with Server 2019 or Windows 10 on, can be very temporary
- Attach the system disk to the conversion VM
- Log into the conversion VM and open an administrator command prompt
- Run
echo list disk | diskpart
to determine the disk number you want to convert (in our example it is Disk 1):C:\Windows\system32>echo list disk | diskpart Microsoft DiskPart version 10.0.17763.1911 Copyright (C) Microsoft Corporation. On computer: WIN-GAIAOBLFJCD DISKPART> Disk ### Status Size Free Dyn Gpt -------- ------------- ------- ------- --- --- Disk 0 Online 32 GB 0 B Disk 1 Online 24 GB 0 B DISKPART>
- Run
mbr2gpt /disk:1 /allowfullos /convert
, replacing 1 by the disk number:C:\Windows\system32>mbr2gpt /disk:1 /allowfullos /convert MBR2GPT will now attempt to convert disk 1. If conversion is successful the disk can only be booted in GPT mode. These changes cannot be undone! MBR2GPT: Attempting to convert disk 1 MBR2GPT: Retrieving layout of disk MBR2GPT: Validating layout, disk sector size is: 512 bytes MBR2GPT: Trying to shrink the OS partition MBR2GPT: Creating the EFI system partition MBR2GPT: Installing the new boot files MBR2GPT: Performing the layout conversion MBR2GPT: Migrating default boot entry MBR2GPT: Adding recovery boot entry MBR2GPT: Fixing drive letter mapping MBR2GPT: Conversion completed successfully MBR2GPT: Before the new system can boot properly you need to switch the firmware to boot to UEFI mode! C:\Windows\system32>
- Shutdown the conversion VM
- Detach the system disk you have just converted
- Re-attach the system disk to the original VM
- Determine the UUID of the original VM. You can get this from XenCenter or by using
xe vm-list name-label="VM NAME"
as shown:[root@xenserver01 ~]# xe vm-list name-label="Windows 10 BIOS" uuid ( RO) : e98a0a89-2fb9-886b-a843-b8a08642afa4 name-label ( RW): Windows 10 BIOS power-state ( RO): halted
- Set the VM to use UEFI boot with
xe vm-param-set uuid=UUID HVM-boot-params:firmware=uefi
as shown:[root@xenserver01 ~]# xe vm-param-set uuid=e98a0a89-2fb9-886b-a843-b8a08642afa4 HVM-boot-params:firmware=uefi
- Start the VM and test it boots correctly
Notes
Converting a disk using mbr2gpt will fail if there is no active partition, settings containing unknown in the BCD bootloader configuration or no recovery partition. You may view any errors by looking at C:\Windows\setupact.log
The active partition can be set with diskpart or in Disk Management.
The bootloader can be viewed and edited as follows. Drive F: represents the disk be converted:
C:\Users\administrator>bcdedit /store f:\boot\bcd /enum active Windows Boot Manager -------------------- identifier {bootmgr} device unknown description Windows Boot Manager locale en-GB inherit {globalsettings} default {default} resumeobject {ec9ff585-ae46-11e9-a7aa-a701b0d3a2b6} displayorder {default} toolsdisplayorder {memdiag} timeout 30 Windows Boot Loader ------------------- identifier {default} device unknown path \Windows\system32\winload.exe description Windows 10 locale en-GB inherit {bootloadersettings} recoverysequence {ec9ff587-ae46-11e9-a7aa-a701b0d3a2b6} displaymessageoverride Recovery recoveryenabled No allowedinmemorysettings 0x15000075 osdevice unknown systemroot \Windows resumeobject {ec9ff585-ae46-11e9-a7aa-a701b0d3a2b6} nx OptIn bootmenupolicy Standard bootstatuspolicy IgnoreAllFailures C:\Users\administrator>bcdedit /store f:\boot\bcd /set {bootmgr} device partition=F: The operation completed successfully. C:\Users\administrator>bcdedit /store f:\boot\bcd /set {default} device partition=F: The operation completed successfully. C:\Users\administrator>bcdedit /store f:\boot\bcd /set {default} osdevice partition=F: The operation completed successfully.