Create a bootable VMware ESXi 5 USB stick in Windows and perform a scripted installation

Here is a simple procedure to make a bootable VMware ESXi 5 or ESXi 6 USB stick in Windows and perform a scripted unattended VMware ESXi installation. The 5 steps are:

Step 1

Be sure removing all partitions and format a FAT32 partition on the USB stick by using the following command:

Open the command prompt and enter the following commands:

diskpart (make sure you run diskpart as administrator) 
list disk (list the disk in your system including the USB) 
select disk USB number 
clean 
create partition primary 
active 
format fs=fat32 quick
assign
exit

Step 2

Download the Windows LinuxLive USB creator utility here.

Step 3

Start the Lili USB creator utility.

 

image

Follow the steps 1,2,4 and click 5 to create the USB stick. Wait till the USB creation process is finished. So now you have a bootable ESXi stick. You can stop here if you you want to install ESXi with manual installation steps.   

Step 4

Edit the BOOT.CFG file in the root of the USB stick and add ks=usb between /b.b00 and — /useropts.gz modules

The BOOT.CFG should look like this:

bootstate=0 
title=Loading ESXi installer 
kernel=/tboot.b00 
kernelopt=runweasel 
modules=/b.b00 ks=usb --- /useropts.gz --- /k.b00 --- /a.b00 --- /ata-pata.v00 --- /ata-pata.v01 --- /ata-pata.v02 --- /ata-pata.v03 --- /ata-pata.v04 --- /ata-pata.v05 --- /ata-pata.v06 --- /ata-pata.v07 --- /block-cc.v00 --- /ehci-ehc.v00 --- /s.v00 --- /weaselin.i00 --- /ima-qla4.v00 --- /ipmi-ipm.v00 --- /ipmi-ipm.v01 --- /ipmi-ipm.v02 --- /misc-cni.v00 --- /misc-dri.v00 --- /net-be2n.v00 --- /net-bnx2.v00 --- /net-bnx2.v01 --- /net-cnic.v00 --- /net-e100.v00 --- /net-e100.v01 --- /net-enic.v00 --- /net-forc.v00 --- /net-igb.v00 --- /net-ixgb.v00 --- /net-nx-n.v00 --- /net-r816.v00 --- /net-r816.v01 --- /net-s2io.v00 --- /net-sky2.v00 --- /net-tg3.v00 --- /ohci-usb.v00 --- /sata-ahc.v00 --- /sata-ata.v00 --- /sata-sat.v00 --- /sata-sat.v01 --- /sata-sat.v02 --- /sata-sat.v03 --- /scsi-aac.v00 --- /scsi-adp.v00 --- /scsi-aic.v00 --- /scsi-bnx.v00 --- /scsi-fni.v00 --- /scsi-hps.v00 --- /scsi-ips.v00 --- /scsi-lpf.v00 --- /scsi-meg.v00 --- /scsi-meg.v01 --- /scsi-meg.v02 --- /scsi-mpt.v00 --- /scsi-mpt.v01 --- /scsi-mpt.v02 --- /scsi-qla.v00 --- /scsi-qla.v01 --- /uhci-usb.v00 --- /tools.t00 --- /imgdb.tgz --- /imgpayld.tgz 
build= 
updated=0

 

Step 5

Create a Kickstart configuration file for the scripted installation in the root of the USB stick. Here is an example:

#Sample kickstart scripted installation
vmaccepteula
rootpw VMw@re
install --firstdisk --overwritevmfs
network --bootproto=static --ip=192.168.250.21 --gateway=192.168.250.1 --nameserver=192.168.250.6 --netmask=255.255.255.0 --hostname=esxi5-01.beerens.local --device=vmnic0 --addvmportgroup=0
reboot

%firstboot --interpreter=busybox
# Rename local datastore name
vim-cmd hostsvc/datastore/rename datastore1 "$(hostname -s)-local-storage-1"
# DNS names
esxcli system hostname set --fqdn=esxi5-01.beerens.local
esxcli network ip dns search add --domain=beerens.local
# DNS server addresses
esxcli network ip dns server add --server=192.168.250.6
esxcli network ip dns server add --server=192.168.250.1
# SSH and ESXi shell
vim-cmd hostsvc/enable_ssh
vim-cmd hostsvc/start_ssh
vim-cmd hostsvc/enable_esx_shell
vim-cmd hostsvc/start_esx_shell

For editing and creating the boot.cfg and ks.cfg file in Windows I use Notepad++ so NO hidden carriage returns are in the files. And the USB stick creation in ready.

An easy way to test the ESXi 5 USB stick and the scripted installation  is using VMware Workstation. See my post “Boot from USB in VMware Workstation” found here.

 

William Lam’s blog has real good information about Kickstart scripts found here.

Install VMware ESXi 4.1 from bootable USB stick

Not all servers nowadays have a DVD player installed. Sometimes it is handy to boot from USB and installing a single VMware ESXi server. Here’s a example how to make the USB stick bootable and install VMware ESXi 4.1 from it by using Windows.

Preparation:

  • Need 1GB USB memory stick or more.
  • Download the VMware ESXi 4.1 ISO named VMware-VMvisor-Installer-4.1.0-260247.x86_64.iso (In this example I used the VMware vSphere Hypervisor version).

Update: The latest version of VMware ESXi is  4.1 Update 1 (VMware-VMvisor-Installer-4.1.0.update1-348481.x86_64.iso). It solves the “Total number of sectors” bug in VMware ESXi 4.1. It is recommend to use this version so the “mod.tgz” workaround isn’t needed anymore!

  • Download Syslinux, can be found by clicking on the following  link. Download the latest Syslinux zip file (when writing this article  syslinux-4.02.zip was the latest).

Update: Also tested Syslinux version 4.03.

Stick the USB stick on a  free USB port on your computer equipped with a Windows OS. For this example I used Windows7 as Operating System. Clear the USB stick and create a partition on it by using the following command’s:

  • Open the command prompt and enter the following commands:
Diskpart (make sure you run diskpart as administrator) 

list disk (list the disk in your system including the USB) 

select disk USB number 

clean 

create partition primary 

active 

format fs=fat32 quick 

assign 

exit

 

To make the USB stick bootable:

  • Extract the Syslinux ZIP and browse to the the \syslinux\win32 folder,  execute “syslinux [drive letter USB stick]”, example syslinux f:
  • Mount the ISO  and copy all the content of the VMware ESXi 4.1 ISO to the USB stick. For mounting the ISO, I used ‘Deamon Tools Lite’ tool.
  • Rename the isolinux.cfg file to syslinux.cfg
  • Edit the syslinux.cfg and add ks=usb and on the end of the append line — mod.tgz (beware of the space between and the mod.tgz).

Update: When using VMware ESXi 4.1 Update 1 the mod.tgz line doesn’t need to append!

default menu.c32

menu title VMware VMvisor Boot Menu

timeout 80

 

label ESXi Installer

menu label ^ESXi Installer

kernel mboot.c32

append vmkboot.gz ks=usb --- vmkernel.gz --- sys.vgz --- cim.vgz --- ienviron.vgz --- install.vgz --- mod.tgz

 

label ^Boot from local disk

menu label ^Boot from local disk

localboot 0x80

  • Create a ks.cfg file in the root from the UBS stick. For example:
rootpw VMware01

install usb

autopart --firstdisk --overwritevmfs

reboot

 

#Network install type

network --bootproto=static --addvmportgroup=false --device=vmnic0 --ip=192.168.1.10 --netmask=255.255.255.0 --gateway=192.168.1.1  --nameserver=192.168.1.1 --hostname=ESXi-01.beerens.local

accepteula

 

%firstboot --unsupported --interpreter=busybox

vim-cmd hostsvc/datastore/rename datastore1 "$(hostname -s)-local-storage-1"

  • Copy the syslinux-4.02\com32\mboot\mboot.c32 file the USB stick (overwrite the old file on the USB stick) 
  • Copy the syslinux-4.02\com32\menu\menu.c32 file the USB stick (overwrite the old file on the USB stick)

The bootable VMware ESXi 4.1 stick is ready for use. When booting  the USB stick the following message is displayed “Total number of sectors not a multiple of sectors per track! Add mtools_skip_check=1 to your .mtoolsrc file to skip this test”.

image

Update: When using VMware ESXi 4.1 Update 1 this bug is fixed. You’re ready to use the USB stick!

On the VMware communities I found the following post. This post states a manual solution by using the following commands:

  • Press ALT-F1
  • Login by using the root account with no password
  • echo “mtools_skip_check=1”>.\mtoolsrc
  • ALT+F2 and return to the orginal Console  window
  • Press ENTER or wait to continue

To automate the above solution read the following blogpost “VMware ESX 4.1 install using Western Digital USB Hard Drive” . By using  this blogpost I created a mod.tgz file by using the following commands from a full installation of VMware ESXi 4.1:

  • Login the VMware ESXi 4.1 console
  • Make a directory in the root for example mkdir temp
  • cd temp
  • mkdir –p etc/vmware/init/init.d/
  • cd etc/vmware/init/init.d/
  • vi 47.mtoolshack
echo "mtools_skip_check=1" >/.mtoolsrc

return ${SUCCESS}

  • Save the fi using the command :wq in VI
  • cd /temp
  • tar czvf mod.tgz etc
  • SCP the file mod.tgz file to the USB stick

The mod.tgz can also downloaded, so the above steps can be skiped. On the end of this article is a download link for the mod.tgz.

The mod.tgz contains an init script which skips the mtools check. Now you’re ready to boot your server with the USB stick and your able to install  VMware ESXi 4.1.                 

Download mod.tgz

Update : When using VMware ESXi 4.1 Update 1 there is no need to add the mod.tgz because this bug is fixed.

 

[ad#banner]

Create a bootable USB to install Windows 8 Server or Hyper-V Server 8

Not all servers nowadays have DVD player installed. Sometimes it is handy to boot from USB and install for example Windows Server 8. Here’s a example how to make the USB stick bootable for the following OS versions:

– Windows Server 8

– Hyper-V Server 8

– Server 2008 R2

– Hyper-V Server R2

Preparation:

– Need 4 GB USB memory stick or more

– Download the desired ISO and save it

Stick the USB stick on a  free USB port on your computer equipped with a Windows OS. For this example I used Windows7 as Operating System. Clear the USB stick and create a partition on it by using the following command’s:

Open the command prompt ((make sure you run the cmd prompt as administrator)

Commands:

diskpart 
list disk "list the disk in your system including the USB"
select disk "USB number"
clean
create partition primary
active
format fs=fat32 quick
assign
exit

Mount the ISO  and copy all the content of the desired ISO to USB stick. For mounting the ISO I used “Deamon Tools Lite”.

Now the bootable stick is ready for use.  Boot your server with the stick and your able to install Windows 8, Windows 8 Server, 2008 R2 or Hyper-V server 8.

[ad#banner]