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
canadait
Hot Shot
Hot Shot

Hi,

I can confirm that this is the exact same issue as I am experiencing. Mike I am glad I read your email as I was loosing my mind.

Reply
0 Kudos
Michelle_Laveri
Virtuoso
Virtuoso

LOL... know what you mean... I feel like I/we are on the cusp of cracking this one... I notice Paul's gone a bit quiet - lets hope he's looking at this one for us Smiley Happy

Because I'm lost on issues to with IMG files... kickstart/syslinux.cfg I'm fine, but that's about it...

Regards

Mike

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

Question,

When you boot the usb drive then use the real cd-rom as install souce does your kicks file work? Mine isn't

Reply
0 Kudos
Michelle_Laveri
Virtuoso
Virtuoso

If I uses a plan unmodified ESX ISO - it finds the ISO fine... and then I get the anaconda/python message...

if I use the IMG provided by Paul, and inject to the ISO... then it comes up message say that its not a valid redhat package something/something... I forget right now... I can grab it - but it sounds like you have the same error?

Regards

Mike

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

Yes same error.

Do you mind posting your esx01 kicks file? or PM me

Reply
0 Kudos
Michelle_Laveri
Virtuoso
Virtuoso

If you read up above this post I cut & pasted my:

boot.msg

syslinux.cfg

and a basic "default.cfg" kickstart script to answer where the hard-drive is...

GOTCHA:[/b]

If a server has /dev/sda/ /dev/sdb and then you plug a USB key in it will be /dev/sdc[i]N[/i]. Go to another server with sda, sdb, sdc then the USB key becomes /dev/sdd... Hope I'm not teaching grama to suck eggs here!

Smiley Happy

I would be great if the USB key was found before SAN/RAID LUNs and was always /dev/sda... I'm disconnecting the SAN before installation (which is a good practise for local installs) but pain-in-the-ass for boot-from-SAN installations where a USB key would be handy. I guess if you have the SAME number of LUNs presented to each blade your OK, but if not then it reduces the level of automation you can do...

So the long and short of it is that in ALL of my files you may need to find and replace the sda4 value...

I've a longer kickstart script that does post-configuration (vSwitches, Software iSCSI, Create Users, and so on) I will attach it here. It works with my PXE appliance - but obiviously never tested it with "ESX-on-a-Stick"

(that the sub-chapter heading in the book)

There's two files here:

esx01 - for servers that present /dev/sda /dev/sdb to the installer and

esx03 - for HP Smart Raid Array Controllers that present /cciss/c0d0

Regards

Mike

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

Just a SWAG, does your new ISO have the .discinfo file in it?

Reply
0 Kudos
Michelle_Laveri
Virtuoso
Virtuoso

Yup... not changing the ISO... just the img file...

Regards

Mike

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

hmmm, I am having no luck with this at all..always get "Operating System Not Found" (i.e. never even tries to boot).

It's an Imation 2GB USB

Formatted FAT

Syslinux done etc

Ideas?

Dave

Reply
0 Kudos
Michelle_Laveri
Virtuoso
Virtuoso

Can I just check... Anyone got this working without error yet. I mean done a basic manual installation from a key...

I'm just trying to work out if its something I've done or if we still have fundemental problems to resolve?

Regards

Mike

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

David I had a imition 1GB drive and it wouldn't boot either. I had to use a tool in the Syslinux download. I have a feeling you might need to do this to...

1. From your Windows PC download the syslinux tools from:

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

2. Extract the ZIP file to you Windows PC

3. Transfer this file to Linux or your Service Console

4. Make a directory and extract the syslinux files to that location with

mkdir /root/syslinux

unzip syslinux-3.36.zip –d /root/syslinux

5. Plug-in your USB Stick into Linux or the Service Console

Note:[/b]

When you do this the system should recognize the device – if you are at the physical console you would see the device being recognized – and would tell you what the /dev/sdn name is of the USB stick. If you miss this message then you can use the command

dmesg | grep sd

This will list all the SCSI devices on the system like so and I can see the USB device has been given the identity of /dev/sdl

SCSI device sda: 2072576 512-byte hdwr sectors (1012 MB)

sda: Write Protect is off

sda: sdl4

sda : READ CAPACITY failed.

sda : status = 1, message = 00, host = 0, driver = 08

Info fld=0xa00 (nonstd), Current sd00:00: sense key Not Ready

sda: block size assumed to be 512 bytes, disk size 1GB.

sda: test WP failed, assume Write Enabled

sda: I/O error: dev 08:b0, sector 0

SCSI device sdl: 2072576 512-byte hdwr sectors (1012 MB)

sda: Write Protect is off

sda: sda4

6. Next we will use Linux command fdisk to delete any existing partition table, and find out the number of cylinders, heads and sectors are on the disk with

fdisk /dev/sdn

Press to print the partition table and make a note of the number of cylinders heads and sectors

Note:[/b]

Below is a print out from an “Imation Mini Flash Drive”

Disk /dev/sdl: 1061 MB, 1061158912 bytes

33 heads, 62 sectors/track, 1012 cylinders

Units = cylinders of 2046 * 512 = 1047552 bytes

7. Press to delete any existing partition

8. Press to write these changes to the USB Stick

9. Next transfer the mkdiskimage to the USB device by

cd /root/syslinux

perl mkdiskimage /dev/sdn -4 1012 33 62

Note:[/b]

This took about 15-20 minutes on my USB stick. The switch -4 indicates an image which is suitable for a zipdisks. The following numbers represent cylinders, heads and sectors. After this command completes you should be able to run fdisk /dev/sdn again to see a partition FAT16 has been created. In my case this reported:

/dev/sda4[/b]

Regards

mike

Regards

Mike

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

Hi all

I create my usb key to boot and install esx 3.0.1 automatically

I have following all the step. It was a bit difficulte to modify the .iso for include the file hdstg2.img but I succed

I explain if it can help somebody :

First put the Vmware esx 3.0.1 CD in your ESX CDROM

run :

dd if=/dev/cdrom of=/folder/esx-3.0.1.iso bs=1024

that's create the Iso image of the ESX CDROM

Now we must mount the Iso

run :

mkdir /mnt/iso

mount -o loop -t iso9660 /folder/esx-3.0.1.iso /mnt/iso

The iso file is mounted so we need to copye it in another folder /root/newiso by exemple

mkdir /root/newiso

cp -r /mnt/iso/* /root/newiso/

Now you can replace the file hdstg2.img in /root/newiso/VMware/base/

For create the new iso you need to install mkisofs.

Go to http://fr2.rpmfind.net/linux/rpm2html/search.php?query=mkisofs&submit=Search+...&system=&arch=[/u]

Take the mkisofs-1.10-11.asp.i386.rpm (the last)

Copy it on the ESX and start : rpm -hiv mkisofs-1.10-11.asp.i386.rpm

To create the iso run :

mkisofs -r -R -J -o /tmp/esx-3.0.1-v2.iso /root/newiso

Now you have the Iso with the new file

Be carful : I have done all and my server boot correctly on the USB Key, I select Hard-Drive and /dev/sda1 for the new image. BUT I have many anaconda error and the installation abort…

That's all the errors :

File "/usr/bin/anaconda" , line 108, in ?

intf.run(id, dispach, configFileData)

File "/tmp/anaconda_build//usr/lib/anaconda/text.py" line 425 in run

File "/tmp/anaconda_build//usr/lib/anaconda/display.py" line 264 in currentStep

File "/tmp/anaconda_build//usr/lib/anaconda/display.py" line 159 in gotoNext

File "/tmp/anaconda_build//usr/lib/anaconda/display.py" line 227 in moveStep

File "/tmp/anaconda_build//usr/lib/anaconda/packages.py" line 147 in readPackages

File "/tmp/anaconda_build//usr/lib/anaconda/hardrive.py" line 208 in readHeaders

File "/tmp/anaconda_build//usr/lib/anaconda/hardrive.py" line 145 in mountMedia

If somebody able to help me to solve it I think I can publish a complet post to make the installation of ESX 3.0.1 just using an usb key ..

Message was edited by:

fbedell

Reply
0 Kudos
Michelle_Laveri
Virtuoso
Virtuoso

mmm, looks like the python error is still there...

I injected the IMG file using WinISO... and will give your method a try and see what I find...

Regards

Mike

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

Mike,

Make sure the primary partition is marked as "active" otherwise it won't be bootable. Good ol' FDISK will do this, option (2).

Paul

Reply
0 Kudos
canadait
Hot Shot
Hot Shot

Everything works for me other then the fact that I can not use the local USB iso image. I can use a local CD though. So close yet so far away.

Reply
0 Kudos
Michelle_Laveri
Virtuoso
Virtuoso

Yep.. the USB sticks primary is marked as bootable... mkdiskimage.pl did all that for me...

My problems are further down the line with the customised version of the ESX3.0.1 ISO with the hdstg2.img...

Not had a chance to try the command-line method... to be honest I think the problem is with the hdstg2.img file...

Do you have this working without errors, Paul?

Regards

Mike

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

Yes, I installed ESX on two of my own servers this way. Let me go back and review your posts to see if I can find anything peculiar...

Paul

Reply
0 Kudos
Michelle_Laveri
Virtuoso
Virtuoso

Paul,

I've been documenting the process for the new book. It's part of a chapter about ESX on the command-line and includes:

PXE/Kickstart Installation

ESX on a stick

Network & Storage esxcfg commands

User Management (su, sudo config, LDAP)

Can I send you the portion on "Esx on a stick" I've writen so far. Perhaps there's something I'm missing - and I'm too close to spot it...

To summarize an ordinary ISO works but gives the Python error... the customized ISO with the .img file throws up an error... I will sceen grab the error...

Your email?

Regards

Mike

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

Mike,

I don't know if I explain correctly my precedent post but with my method your are able to custumize the ISO to put the .img file giving by Paul.

You boot with USB ans select your correct /dev/sda.... and the key find well the Iso file.

But the python problem still...

I post here the anacdump.log from debug screen if can it help someone.

Traceback (most recent call last):

File "/usr/bin/anaconda", line 1087, in ?

intf.run(id, dispatch, configFileData)

File "/tmp/anaconda_build//usr/lib/anaconda/text.py", line 425, in run

File "/tmp/anaconda_build//usr/lib/anaconda/dispatch.py", line 264, in currentStep

File "/tmp/anaconda_build//usr/lib/anaconda/dispatch.py", line 159, in gotoNext

File "/tmp/anaconda_build//usr/lib/anaconda/dispatch.py", line 227, in moveStep

File "/tmp/anaconda_build//usr/lib/anaconda/packages.py", line 147, in readPackages

File "/tmp/anaconda_build//usr/lib/anaconda/harddrive.py", line 208, in readHeaders

File "/tmp/anaconda_build//usr/lib/anaconda/harddrive.py", line 145, in mountMedia

KeyError: 1

Local variables in innermost frame:

cdNum: 1

self: Mar 23 08:07:21 loader: Installer SCSI detection: adding LUN sda/'Kingston DataTraveler II+'

Reply
0 Kudos
Michelle_Laveri
Virtuoso
Virtuoso

Wow... my error is much shorter than that! Smiley Wink

I have "Device /dev/sdb4 does not appear to contain Red Hat CD-ROM images..."

Anyway, I'm gonna try making my ISO by the DD method and report back my findings later...

Regards

Mike

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