VMware Cloud Community
Paul_Lalonde
Commander
Commander

HOWTO: Installing ESX Server from a USB flash drive

After Mike Laverick posted his experience with ESX Server and USB flash disks in another thread, I decided to figure out how to make it work.


Here's a quick rundown on setting up a USB flash disk (ie. pen drive, flash key, etc.) to install ESX Server.


Requirements:



\- You will need at least a 1 GB USB flash disk.


\- You must have

both

the ESX 3.x CD-ROM and ISO image handy.


\- You will need an ISO image extraction tool such as WinISO, MagicISO, or even WinRAR.


\- You'll need SYSLINUX, a Linux boot loader for removable media. Get it here:





http://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-3.36.zip





\- These instructions are based on a Windows PC for simplicity. If you're a Linux guru, then you can obviously do this under Linux. You'd need to know how to mount .ISO images in order to extract files, etc.








Steps Required:





1. Plug in your USB flash disk and format it under Windows. Use the FAT filesystem (not FAT32, although it would probably work).



2. From Windows Explorer, find the

boot.iso

file in the

/images

directory on the ESX 3.x CD-ROM. Copy

boot.iso

into a temporary directory on your hard drive.






3. Using your ISO extraction program of choice, extract the contents of the

boot.iso

file to your USB flash drive. On my PC, it's the

E:

drive.




4. Delete the

isolinux.bin

and

updatecd.cfg

files from the USB flash disk.



5. Rename the

isolinux.cfg

file on the USB flash disk to

syslinux.cfg





6. Using WordPad (not Notepad), open the

syslinux.cfg

file and add the keyword usbto the end of every line that begins with

append

. Here's what the file should look like when you're done:



default esx

prompt 1

timeout 600

display boot.msg

F1 boot.msg

F7 snake.msg

label debug

kernel vmlinuz

append initrd=initrd.img noapic nomediacheck debug usb

label esx

kernel vmlinuz

append initrd=initrd.img usb

label text

kernel vmlinuz

append initrd=initrd.img text usb

label expert

kernel vmlinuz

append expert initrd=initrd.img usb

label ks

kernel vmlinuz

append ks initrd=initrd.img usb

label lowres

kernel vmlinuz

append initrd=initrd.img lowres usb



7. Now, extract the

syslinux

.zip file into another temporary directory on your hard drive.



8. Open up a command prompt and use the

cd

command to navigate into the

win32

directory. For example:

cd C:\temp\syslinux-3.36\win32</p>

9. Now, run the syslinux program to apply the boot loader and boot sector to the USB flash drive:</p>

syslinux -s e:


( On my PC, my USB flash drive is mounted as drive E: )



10. Finally, copy the ESX 3.x ISO image onto the flash drive:



+copy c:\iso\esx-3.0.1-32039.iso e:\ +



11. Confirm that your USB flash drive contains the following files:



boot.cat

boot.msg

initrd.img

snake.msg

splash.lss

vmlinuz

syslinux.cfg

esx-3.0.1-32039.iso



12. You're all set! Unplug the USB flash drive, configure the BIOS on your server to boot from USB accordingly, and boot 'er up!



13. The ESX installer will detect the USB device and whatever SCSI / disk controllers you have. When the installer asks you what the installation source will be, choose

Hard Disk

.



14. You will need to choose the right disk device (ie. /dev/sda, /dev/sdb) that corresponds to your USB flash disk. Chances are it will be /dev/sdb.



15. Finally, the installer will ask you what directory to find the ESX installation CD image in. Just use / and it will find the .ISO image for you.



16. The rest is history!



Please let me know how this works for you and if you run into any glitches. This is going to save me a lot of time since I don't have CD-ROM drives in all of my servers!!

Paul

Reply
0 Kudos
100 Replies
MJKNIGHT
Hot Shot
Hot Shot

Paul,

Excellent post, I assume I could also embed a series of ks.cfg files onto the USB key and modify the syslinux.cfg to have entries to auto build a suite of ESX servers.

Now of to find my USB key Smiley Wink

Michael.

Reply
0 Kudos
Michelle_Laveri
Virtuoso
Virtuoso

My thoughts precisely Michael.

Thanks a billion Paul for this - do you mind if I reference this for the book?

FYI... I've been working with PXE appliance that will deploy ESX - the only interaction required is an ILO and F12... comes with a menu. It will be in the book as well - although I plan to release the getting-started guide to it on RTFM... the original developer wants to add some ESX 3.x functionality - so we can create kickstart file using a wizard (which hopefully be better than VMware's...) and the option to hard-code scripts by MAC address for additional security...

My interest in this USB key is related to this as well...

Anyway, thanks once again -

regards

mike

ps thought it was best to thank you hear than extend a Windows Vs Linux flame on the other thread!!!! Smiley Happy

Regards
Michelle Laverick
@m_laverick
http://www.michellelaverick.com
Reply
0 Kudos
oreeh
Immortal
Immortal

Thanks Paul !

Another post for a possible howto section in these forums.

@Mike: I don't want to start a Linux vs Windows flame war.

Reply
0 Kudos
Jae_Ellers
Virtuoso
Virtuoso

Paul, you rock. Have you gotten any job offers based on the work you've done on this board? You have put out some amazing work.

Thanks.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=- http://blog.mr-vm.com http://www.vmprofessional.com -=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Reply
0 Kudos
Michelle_Laveri
Virtuoso
Virtuoso

Well, i gave that shot... got so far, but hit a road block. This might be down to my type of pen drive - which one of those SanDisk types which appears to have a protected/hidden 5MB CD-ROM style partition somewhere before the Pen drive itself which holds the software for the pen drive itself...

The HP DL385 G1 boots from the pen drive just fine. But when I get to the point where I would select the ISO file. What I actually get is:

/dev/sda1

/dev/sda2

/dev/sda3

/dev/sda4

This is on a server with a single LUN which I wiped especially for this test. I don't see a /dev/sdb - and although I've tried /dev/sdb and variants on this theme it doesn't seem to be finding the pen drive after booting from it...

I have a feeling it might be the SanCruiser. Might buy another 1GB stick that is more vanilla and try again...

Regards

Mike

Regards
Michelle Laverick
@m_laverick
http://www.michellelaverick.com
Reply
0 Kudos
tarrysingh
Contributor
Contributor

Fine job, Paul!

Reply
0 Kudos
tbrown
Contributor
Contributor

I successfully setup ESX on my Verbatim memory key.

For reference I used:

http://www.verbatim.com/products/product_detail.cfm?product_id=927B2C1D-65B0-5A0F-8394C58CF9A7751E&p...

Now to setup my KS files.

Reply
0 Kudos
Paul_Lalonde
Commander
Commander

UPDATE: Fix for "BUG" in Anaconda installer script



I've discovered a "bug" in the

partitions.py

Python script that gets invoked by the Anaconda installer.



Right after you click on the "Agree" checkbox in the EULA screen, you're presented with a disk partitioning question: Recommended or Advanced. Regardless of which choice you make, the next screen normally presents the disk partition layout. In the case of this USB-based installer, though, Anaconda generates an unhandled exception (Traceback) and the installation aborts.



The failed Python module, partitions.py, normally attempts to "protect" the filesystem that houses the .ISO image for installation. However, in the case of a USB-based install, this protective mechanism fails and causes the installation to die ungracefully.



I've patched this module and re-integrated it back into the

hdstg2.img

file. In order to apply this patch, you'll need to do the following:

1. Download the patch from: Warning: File is approx. 10 MB



http://home.cogeco.ca/~plalonde2/hdstg2.img



2. Open up the esx .ISO file on your USB flash key using WinISO, MagicISO, etc.



3. Navigate into the

/VMware/base

directory within the ISO file.



4. Delete the

hdstg2.img

file in the /VMware/base directory.



5. Add the patched

hdstg2.img

version back in.



6. Save the ESX .ISO back to the USB flash drive.



Problem solved!!



I tested the ESX install using a 1GB USB flash drive and the entire installation took less than 3 minutes.



Hope this helps!

Paul


PS. If you're a Linux guru and you would rather re-create the hdstg2.img file yourself, you can download just the patched Python script here:

http://home.cogeco.ca/~plalonde2/partitions.pyc

It goes in the /usr/lib/anaconda/ directory within the hdstg2.img cramfs filesystem.


Message was edited by: Paul Lalonde

Note: All files contained in the hdstg2.img file fall under the GPL are are included in the VMware ESX Server open source packages.

Reply
0 Kudos
Paul_Lalonde
Commander
Commander

Hey Mike, you are more than welcome. Feel free to use any of this information in whatever manner you like.

Have fun!

Paul

Reply
0 Kudos
grad
Contributor
Contributor

Getting error message:

C:\testesx\test\win32>syslinux -s e:

Reading boot sector: The parameter is incorrect.

what is wrong?

making usb disk under windows 2003 standard R2 release

Reply
0 Kudos
Jwoods
Expert
Expert

OMG Paul this is excellent. I've been trying to get this working off and on for quite awhile now. Thanks a million! You deserve 50 points for this!

Reply
0 Kudos
Paul_Lalonde
Commander
Commander

Is your USB flash device properly partitioned and formatted for FAT-16?

Paul

Reply
0 Kudos
grad
Contributor
Contributor

Yep , when i look in diskmanagement it's FAT

Reply
0 Kudos
Schorschi
Expert
Expert

Ok, this is fine, did this months ago, but I could not get past one key issue, anaconda has an issue with finding the ks.cfg file that is on the flash source. I could never get a ks.cfg to complete correctly using this method.

Reply
0 Kudos
Paul_Lalonde
Commander
Commander

Glad to hear it. Now try this:

esx boot text nofb usb ks=hd:sdb1:/ks.cfg

(where sdb1 is the device of the USB flash, replace as necessary)

with the ks.cfg file in the root directory of the USB flash drive.

Paul

Reply
0 Kudos
Michelle_Laveri
Virtuoso
Virtuoso

Paul,

What method do you use to update hdstg2.img within the ISO. I'm using WinImage which treats the ISO as closed/read-only. I'm trying to aviod reburning a CD with the new file with nero and creating an ISO from that...

I'm been doing some work on this over the weekend. This is what I have got so far:

I changed the syslinux.cfg to disable graphical installations (not supported with hard disk media installs - and added a menu option to install my server(s)

default text

prompt 1

timeout 600

display boot.msg

F1 boot.msg

F7 snake.msg

label debug

kernel vmlinuz

append initrd=initrd.img noapic nomediacheck debug usb

label esx

kernel vmlinuz

append initrd=initrd.img usb

label text

kernel vmlinuz

append ks initrd=initrd.img text usb ks=hd:sda4:/kickstart/default.cfg

label expert

kernel vmlinuz

append expert initrd=initrd.img usb

label ks

kernel vmlinuz

append ks initrd=initrd.img usb

label lowres

kernel vmlinuz

append initrd=initrd.img lowres usb

label esx01

kernel vmlinuz

append ks initrd=initrd.img usb ks=hd:sda4:/kickstart/esx01.cfg

label esx01

kernel vmlinuz

append ks initrd=initrd.img usb ks=hd:sda4:/kickstart/esx02.cfg

label esx01

kernel vmlinuz

append ks initrd=initrd.img usb ks=hd:sda4:/kickstart/esx03.cfg

The kickstart/default.cfg stops the prompts to do with being asked what disk to use and how to find the ISO file

\# Auto-Generated Scripted Install Configuration file.

\# This file is used for VMware ESX Server Scripted Install Deployment

\# Installation Method

harddrive --partition=sda4 --dir=/

\# Mouse

mouse none

%packages

@base

%post

For a bit of fun I modified the boot.msg file to give friendly information

splash.lss

- To install or upgrade 03VMware ESX Server 07 in text mode, press 0f 07

- Note: Graphical Mode is not supported with ESX-on-a-Stick

One real problem I can see with this - is how much /dev/sd[i]NN[/i] varies from system to system. I see it change depending if the SAN is connected (I get /dev/sdk4) the USB stick always appears as the last drive. Alternatively, on my HP proliants - because the first LUN is /ccisso/c0d0, the USB stick appears without the SAN connected the USB drive is /dev/sda4.... I wish we could hard-code the usb device to always be /dev/sdz - that way I could move the key from system to system and 9/10 it would know which disk contained the kickstart files and the ISO...

Regards

Mike

Regards
Michelle Laverick
@m_laverick
http://www.michellelaverick.com
Reply
0 Kudos
canadait
Hot Shot
Hot Shot

Mike,

I believe that you have to remove the U3 software to get rid of that darn virtual cd-rom drive that it tries to run. I just bought a cruzer and had the same issue until I removed the U3 software.

Reply
0 Kudos
Michelle_Laveri
Virtuoso
Virtuoso

Yeah, I got the cruiser to work by using the boot disk image tool... was able to do that without need to get rid of the U3 partition...

Regards

Mike

ps I bought WinISO today to assist injecting the IMG file provide by Paul...

Regards
Michelle Laverick
@m_laverick
http://www.michellelaverick.com
Reply
0 Kudos
Michelle_Laveri
Virtuoso
Virtuoso

well, I'm not having any fun with this...

I bought WinISO today - and I was able to open the ESX iso and add the file that Paul modified... BUT now the Anaconda installer believes the ISO is not there...

I've checked and the ISO works fine as a normal CD...

The only thing that's different between my two ISOs - is the adding of the .IMG file and the fact that its been processed by WinISO... I've checked thier FAQ's and emailed support...

Has anyone got this working without error... not sure where I am going wrong... my only barrier is the python error and the img file...

Paul what are your thoughts?

Regards

Mike

Regards
Michelle Laverick
@m_laverick
http://www.michellelaverick.com
Reply
0 Kudos