Enterprise Datacenter Management Voodoo
Posts tagged esxi 4.1
VMware ESXi 4.1 install using Western Digital USB Hard Drive
Aug 19th
Wish I had better news. It can’t be done. After disabling all that ‘Smartware’ software as explained by on Western Digital’s website, I still fail when it tries to do an mcopy to grab the kickstart file.
And after loading all you get to see is:
rescanning in 10 second(s), press
I copied everything on to a different drive and it worked fine. Moral of the story: Take back your WD USB Hard Drive and get one that’s less ‘smart’
More notes on ESXi 4.1 Kickstart
Aug 13th
ESXi 4.1 kickstart is adequate for most things but I still have several issues with it that I consider ‘bugs’:
1. If you’re not connected to a network, it doesn’t work. This is fine since most people will be on a network with VMware anyway right? Fine, I’ll let this one slide. But if you just have a machine and a usb stick, then why do you need the network? Sure you’ll have it eventually but I just want to test it on my server on my desk…
2. The kickstart file likes to stop and give you alerts even if everything is ok. As an example: In the post install script if I don’t put the interpreter it stops and gives me a note: “Interpreter not specified, using busybox” That’s fine, that’s what the default is. Why stop me? The docs state clearly that the default is busybox.
3. Name resolution doesn’t work in postscripts. If you’re trying to get information from other hosts, it doesn’t work. Forget it. Just put in the IP address in your post install script.
4. USB installations without kickstart don’t work. You need to have a CD/DVD image. This is lame. In an era where most servers I deal with don’t have DVD roms, why make me buy a usb DVD drive? A $10 usb stick should do this just fine.
5. Lack of mount support. This kills me. I want to have a USB drive boot up ESXi 4.1 in kickstart and then boot up with a virtual machine. Problem is my virtual machine is 60GB. After digging around, I see that ESXi 4.1 can get files from a FAT32 filesystem by using the mcopy command. (It doesn’t do a mount). But what I really want is ext3 support so that I can copy 60GB files onto a hard disk. I’m thinking about hacking an ext3 driver for busybox, but I don’t know how difficult that will be. Right now, my options seem to break up my disk image into 2GB chunks so they fit on the FAT 32 partition… lame. Anyway, please don’t tell me to consider NFS and all that stuff, because I know that’s the optimal solution. This project is a little different than what you may be thinking of.
Anyway, I don’t want to keep complaining, so here are some nice things:
Enable SSH on the TSM.
We want SSH on our machines, even if its not supported. So we add this to our kickstart file:
%firstboot –interpreter=busybox –unsupported –level=47
sed -ie ‘s/#ssh/ssh/’ /etc/inetd.conf
Mounting USB drives
As I mentioned you can’t mount USB drives on ESXi 4.1. (At least I haven’t figured it out yet). You can do passthrough with the USB drives so that the VMs can mount them, but you can’t actually mount it on the hypervisor.
However you can copy files from the FAT32 partition. Here is an example of a command to use in a kickstart file:
mcopy -i /dev/disks/mpx.vmhba32:C0:T0:L0:1 \::IMAGEDD.BZ2 /install_cache/IMAGEDD.BZ2
(In fact, this is the exact command used by the installer to grab the bz2 image from the fat 32 partition)
So if you had a file named foo on there, you could substitute it in for the IMAGEDD.BZ2 file name and copy it onto your hypervisor. I would do this for copying *vmx files or things like that.
There’s one catch: The mcopy command is available during installation, but upon reboot, there is no mcopy command! So if you want it, then a good idea is to copy it during the kickstart file to some place where you can get it after its installed.
Anyway, happy VMware VMworld to all you who are going.
Creating USB key to install VMware ESXi 4.1
Jul 20th
Many servers don’t have DVD drives nor CD drives, so installing ESXi 4.1 with a CD is not optimal. Sure you could always buy a USB DVD drive, but why not try to be cool and do it with a USB stick instead? I’m actually a bigger fan of doing things through PXE. Network installs are the ideal way to manage datacenters. However, sometimes, if you’re a rovering IT guy like me going from site to site, you can’t always do network installs. There are an amazing amount of IT shops that I have run into that shun the idea of network installs. 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.
1. Get the VMware ESXi 4.1 ISO image from VMware.com.
2. Open the image. On my mac, I just click on the image and it opens it for me. On Linux you could do a loop back mount:
mkdir /media/ISO mount -o loop VMware-VMvisor-Installer-4.1.0-260247.x86_64.iso /media/ISO
If you have Windows, I’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.
4. Now get a USB stick. You need to partition a large enough windows 95 image and make it bootable. I do this through fdisk:
fdisk /dev/sdc (or whatever it shows up as) d (delete all partitions) n # new partition p # primary partition 1 # 1 is the partition number. 1 # the first cylinder +300M # the size a # toggle bootable flag 1 # make partition 1 bootable t # change the type 1 # of partition 1 b # partition type W95 FAT32 w # write it out
5. Now you need to format it:
mkfs.vfat -n BOOT -F 32 /dev/sdc1
6. Now we need to use syslinux and make it bootable. I do this on Linux like this:
syslinux -s /dev/sdc1 dd if=/usr/lib/syslinux/mbr.bin of=/dev/sdc # note that this is sdc not sdc1
7. Mount the USB stick and copy all the files to it:
mkdir /media/USB mount /dev/sdc1 /media/USB cp -a /media/ISO /media/USB
8. Now you have to get rid of the isolinux stuff:
rm -rf isolinux.bin mv isolinux.cfg syslinux.cfg
9. 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. The problem is (in my opinion) is that the Installer is hard coded to look for the CDROM. So you will error out saying that it can’t find the installation media. This is pretty lame. But that’s ok because I want to automate this anyway. So the answer is we make a kickstart file that can tell it where to go. So let’s edit the syslinux.cfg and add a kickstart file. We add these files to /media/USB where our USB is mounted.
The modified syslinux.cfg file:
Here we simply add the ks=usb argument. This tells it to use kickstart and that the kickstart file is found on the USB drive.
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 label ^Boot from local disk menu label ^Boot from local disk localboot 0x80
The Kickstart file (ks.cfg)
My simple kickstart file (ks.cfg) just looks like this:
vmaccepteula rootpw cluster autopart --firstdisk --overwritevmfs install usb network --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
10. There, now you’re done. Unmount the USB key, Put it in the server and it will install ESXi4.1 from the USB key without any prompting. Fun in 10 easy steps!