Creating a bootable USB stick to install VMware ESXi

I had to install VMware ESXi on a machine that didn’t have a CDROM or DVD player. For extra difficulty, I also didn’t have a Linux box with a USB drive handy - but after a bit of hair pulling, I managed to create a bootable USB stick image in Linux (In my case Gentoo). Hat tip to http://communities.vmware.com/thread/75792

  1. Create a fake filesystem. I created a 1Gb, but 512Mb should be enough

    dd if=/dev/zero of=/mnt/vmware.img bs=1024 count=1048576
  2. Associate it with a loopback device

    losetup /dev/loop0 vmware.img
  3. Create a FAT filesystem on the image

    mkfs.vfat /dev/loop0
  4. Mount the VMware CD ISO to a temporary directory

    mkdir -p /mnt/vmware
    mkdir -p /mnt/vmware-usb
    mount -t iso9660 -o loop /path/to/vmware.iso /mnt/vmware
    mount -t vfat -o loop /mnt/vmware.img /mnt/vmware-usb
  5. Copy the contents across

    cp -r /mnt/vmware/* /mnt/vmware-usb
  6. Delete the isolinux.bin and rename isolinux.cfg file on the USB flash disk to syslinux.cfg in /mnt/vmware-usb
  7. Add usb to the end of the append line in syslinux.cfg
  8. Run syslinux to write a bootloader

    syslinux -s /dev/loop0
  9. Unmount everything

    cd /mnt
    unmount /mnt/vmware
    unmount /mnt/vmware-usb
    losetup -d /dev/loop0

vmware.img should now be a bootable USB image. You will need to write it to your USB stick now. In linux you can use dd (assuming your USB stick is at sdb):

dd if=/mnt/vmware.img of=/dev/sdb

In windows, use Image Writer for Windows.Or, an easier solution might be to buy a DVD Drive :)