{"id":171,"date":"2010-07-20T09:22:42","date_gmt":"2010-07-20T15:22:42","guid":{"rendered":"http:\/\/benincosa.com\/blog\/?p=171"},"modified":"2014-11-19T11:26:26","modified_gmt":"2014-11-19T17:26:26","slug":"creating-usb-key-to-install-esxi-4-1","status":"publish","type":"post","link":"https:\/\/benincosa.com\/?p=171","title":{"rendered":"Creating USB key to install VMware ESXi 4.1"},"content":{"rendered":"<p>Many servers don&#8217;t have DVD drives nor CD drives, so installing ESXi 4.1 with a CD is not optimal.\u00a0 Sure you could always buy a USB DVD drive, but why not try to be cool and do it with a USB stick instead?\u00a0 I&#8217;m actually a bigger fan of doing things through PXE.\u00a0 Network installs are the ideal way to manage datacenters.\u00a0 However, sometimes, if you&#8217;re a rovering IT guy like me going from site to site, you can&#8217;t always do network installs.\u00a0 There are an amazing amount of IT shops that I have run into that shun the idea of network installs.\u00a0 So, for those still in the dark ages, or for those who are on the road a lot, here is how we do it with a USB stick in 10 easy steps.<\/p>\n<p>1.\u00a0 Get the VMware ESXi 4.1 ISO image from VMware.com.<\/p>\n<p>2.\u00a0 Open the image.\u00a0 On my mac, I just click on the image and it opens it for me.\u00a0 On Linux you could do a loop back mount:<\/p>\n<pre>mkdir \/media\/ISO\r\nmount -o loop VMware-VMvisor-Installer-4.1.0-260247.x86_64.iso \/media\/ISO<\/pre>\n<p>If you have Windows, I&#8217;m sure you can use your favorite search engine to find a way to do it, but the rest of this tutorial is in Linux.<\/p>\n<p>4.\u00a0 Now get a USB stick.\u00a0 You need to partition a large enough windows 95 image and make it bootable.\u00a0 I do this through fdisk:<\/p>\n<pre>fdisk \/dev\/sdc (or whatever it shows up as)\r\nd (delete all partitions)\r\nn # new partition\r\np # primary partition\r\n1 # 1 is the partition number.\r\n1 # the first cylinder\r\n+300M # the size\r\na # toggle bootable flag\r\n1 # make partition 1 bootable\r\nt # change the type\r\n1 # of partition 1\r\nb # partition type W95 FAT32\r\nw # write it out<\/pre>\n<p>5.\u00a0 Now you need to format it:<\/p>\n<pre>mkfs.vfat -n BOOT -F 32 \/dev\/sdc1<\/pre>\n<p>6.\u00a0 Now we need to use syslinux and make it bootable.\u00a0 I do this on Linux like this:<\/p>\n<pre>syslinux -s \/dev\/sdc1\r\ndd if=\/usr\/lib\/syslinux\/mbr.bin of=\/dev\/sdc  # note that this is sdc not sdc1<\/pre>\n<p>7.\u00a0 Mount the USB stick and copy all the files to it:<\/p>\n<pre>mkdir \/media\/USB\r\nmount \/dev\/sdc1 \/media\/USB\r\ncp -a \/media\/ISO \/media\/USB<\/pre>\n<p>8.\u00a0 Now you have to get rid of the isolinux stuff:<\/p>\n<pre>rm -rf isolinux.bin\r\nmv isolinux.cfg syslinux.cfg<\/pre>\n<p>9.\u00a0 At this point you should be able to umount the USB drive and stick it in a server and boot from it and start the installer.\u00a0 The problem is (in my opinion) is that the Installer is hard coded to look for the CDROM.\u00a0 So you will error out saying that it can&#8217;t find the installation media.\u00a0 This is pretty lame.\u00a0 But that&#8217;s ok\u00a0 because I want to automate this anyway.\u00a0 So the answer is we make a kickstart file that can tell it where to go.\u00a0 So let&#8217;s edit the syslinux.cfg and add a kickstart file.\u00a0 We add these files to \/media\/USB where our USB is mounted.<\/p>\n<h4>The modified syslinux.cfg file:<\/h4>\n<p>Here we simply add the ks=usb argument.\u00a0 This tells it to use kickstart and that the kickstart file is found on the USB drive.<\/p>\n<pre>default menu.c32\r\nmenu title VMware VMvisor Boot Menu\r\ntimeout 80\r\n\r\nlabel ESXi Installer\r\nmenu label ^ESXi Installer\r\nkernel mboot.c32\r\nappend vmkboot.gz ks=usb --- vmkernel.gz --- sys.vgz --- cim.vgz --- ienviron.vgz --- install.vgz\r\n\r\nlabel ^Boot from local disk\r\nmenu label ^Boot from local disk\r\nlocalboot 0x80<\/pre>\n<h4>The Kickstart file (ks.cfg)<\/h4>\n<p>My simple kickstart file (ks.cfg) just looks like this:<\/p>\n<pre>vmaccepteula\r\nrootpw cluster\r\nautopart --firstdisk --overwritevmfs\r\ninstall usb\r\nnetwork --bootproto=static --ip=192.168.70.76 --gateway=192.168.70.1 --hostname=sumavihv --device=vmnic0 --nameserver=192.168.70.1 --netmask=255.255.255.0<\/pre>\n<p>10.\u00a0 There, now you&#8217;re done.\u00a0 Unmount the USB key, Put it in the server and it will install ESXi4.1 from the USB key without any prompting.\u00a0 Fun in 10 easy steps!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Many servers don&#8217;t have DVD drives nor CD drives, so installing ESXi 4.1 with a CD is not optimal.\u00a0 Sure you could always buy a USB DVD drive, but why not try to be cool and do it with a USB stick instead?\u00a0 I&#8217;m actually a bigger fan of doing things through PXE.\u00a0 Network installs&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[68,13,67,981],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/posts\/171"}],"collection":[{"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/benincosa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=171"}],"version-history":[{"count":7,"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/posts\/171\/revisions"}],"predecessor-version":[{"id":173,"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/posts\/171\/revisions\/173"}],"wp:attachment":[{"href":"https:\/\/benincosa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/benincosa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/benincosa.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}