Booting ESXi from USB disk

ESXi 4 has such a small footprint that it can be easily run from 2GB USB flash disk. This way one can make very small disk less ESX server.

In the case the ESXi host does not have CD ROM, one of the ways to prepare ESXi USB disk is using VMware Workstation. Create VM, with 2 GB RAM, CD ROM, NIC and USB controller. Mount the ESXi ISO to the CD ROM, plug in the USB disk and start the VM. Connect the USB disk to the VM and proceed with the ESXi install from the CD. It takes a while depending on the speed of the flash disk.

Once done turn off the VM and unplug the flash disk. It is now ready to be plugged in to the ESXi host. Set the correct boot order in BIOS in order to start the system from the flash disk. The system loads pretty quickly and is ready for the initial configuration (management network, root password, etc.). If the system finds an empty local disk during this stage, it creates VMFS datastore on it. And here comes the problem: first of all it also creates 2 other partitions (DOS and VMware Diagnostic). The second problem is that you cannot set the block size of the VMFS partition. It defaults to 1MB and it means you cannot create larger than 256 GB VMDKs.

If you try to delete the default datastore and create a new one you will get:

Error during the configuration of the host: DestroyVmfsDatastore can’t delete partition 3 on lun mpx.vmhba1:C0:T0:L0.

There are two ways around this. Either make sure that all local disks are disconnected (either physically or in BIOS) during the initial boot up of the ESXi. Then no default datastore is created. If it is too late and you do not feel like duing reinstall you can do this:

Enable UNSUPPORTED mode (on the physical console, press alt F1 and type ‘unsupported’ <enter>and log in with root password, which will open the busybox console)

List all the drives and partitions on the system: fdisk -l

Find the disk that containts the partition you want to delete

Delete them with fdisk:fdisk /dev/disks/mpx.vmhba1:C0:T0:L0
press d (delete) and partition number 3
repeat for all three partitions
press w (write) to write the changes to disk

Rescan the disk with vSphere Client. The datastore1 is gone and you can create a new one with the right block size spanning the whole disk.