HyperV Linux EFI VHDX migration is missing EFI in the boot options

I have a HyperV 2016 cluster of n machine running on W2k16.

I've duplicated the VHDX of a RHEL 7.5 (Gen2) VM that runs with this boot order (and secure boot disabled):

Screenshot

After creating a new VM with the cloned disk, the EFI file entry disappeared, and I was not able to boot anymore.

Note: If I boot from a Rescatux CD I see all the boot entries correctly listed and I can boot (manually from that disk) into RHEL


UEFI boot options are stored in UEFI variables, not on a disk. This is true for physical machine or virtual machines. Hyper-V stores UEFI variables in one of the VM state files, not the VHD. So when you dissociated the VHD from the VM, you lost the UEFI variables and the boot entries.

If you want to clone a machine which is depending on UEFI variables to boot, export the VM and import it again. This will keep the state files and the VHD together as a set, rather than splitting them apart.

Incidentally, not all guest OSes set up the UEFI variables in the way that RHEL did here, which is why you don't always see this problem. Some OSes, including Windows, set the UEFI boot variable to point to a disk, not a file on the disk, and the UEFI specification says where to find boot files in default locations on the disk. I only mention this because the next question people usually ask is about why it seems to fail only some of the time.