Hint: this post is also available in Chinese.

Four months ago I brought an HP Z620 workstation to run virtual machines at home with Hyper-V Server. Some days later I planned to replace the SSD in the workstation from Samsung 860EVO 500G to Intel DC P4510 2TB for more capacity and better performance. But after hardware upgrade I found that P4510 just didn't get recognize by the boot loader. It seemed that I need to do some more work to boot ESXi from this NVMe SSD.

The simplest solution is using Clover Boot Loader as secondary boot loader. But the automatic OS scans provided by Clover does not support VMware ESXi, meanwhile creating a custom entry is quite bother job as writing XML manually by human is just another disaster.

After some simple research I reached out that unified extensible firmware interface itself dose support load driver before OS boot, so EFI Shell with a customized startup script may solve this problem for me. Firstly create a ESP partition on one disk with GUID partition table which is recognizable by the stock firmware, copy UEFI Shell binary as well as the NVMe driver binary to that partition, then create startup.nsh in that partition with following script:

load -nc fs0:\NvmExpressDxe-64.efi
connect -r
map -u
fs1:\EFI\BOOT\BOOTX64.EFI

The script is quite easy to understand. But remember to change the locations and names of these binaries to your own.

After that, use efibootmgr under Linux or some utilities under Windows PE to create a new EFI boot entry with EFI shell as the loader, and then set it to default entry. Note that the disk alias may be different on each machine, to find out your own aliases just boot into the efi shell, load the NVMe driver and use the map command to show partition aliases.

May be the simplest solution is just install ESXi to one HDD and place all virtual disks in the NVMe SSD?

References

  1. [Guide] NVMe-boot without modding your UEFI/BIOS (Clover-EFI bootloader method)
  2. UEFI Shell Specification
  3. Error-handling in EFI startup shell scripts - Super User