Installing ESXi imagedd.bz2

Now that I’ve managed to mount the CDROM, I can manually DD the image onto the destination disk.

I can do this will the following python script, all within the ESXi installer itself. I can scp this file in, and run it [and write any other preformatted .bz2 file onto the hard disk]:

#! /usr/bin/env python

# File: writeesxi.py

import bz2
import os

buffsize = 1024 * 1024 # 1MB blocks

i_filename = "/vmfs/volumes/mpx.vmhba32:C0:T0:L0/IMAGEDD.BZ2"
#i_filename = "IMAGEDD.BZ2"
o_filename = "/vmfs/devices/disks/mpx.vmhba1:C0:T0:L0"
#o_filename = "IMAGEDD"

bz2_file = bz2.BZ2File(i_filename)
#out_file = os.open(o_filename,os.O_RDWR|os.O_TRUNC|os.O_CREAT)
# ESXi doesn't like TRUNC or CREAT. Assume the file exists:
out_file = os.open(o_filename,os.O_RDWR)

while True:
  b = bz2_file.read(buffsize)
  if len(b) == 0 :
    break
  os.write(out_file,b)
  os.write(1,".")

os.close(out_file)
bz2_file.close()
print

Now that I can arbitarily write images onto the hard disk, I should be able to make a cut down 64MB ESXi server.

Advertisements

One Response to Installing ESXi imagedd.bz2

  1. David Tenney says:

    Hi Chris,

    I’ve read a lot of posts regarding ESXi not being able to be installed via USB. After researching through the install.vgz file, I noticed that is looks like they specifically point to the cdrom as the installation device in the python scripts. I am by no means a python programmer, but I was wondering if you had any ideas on how to call a USB/NFS device for the image instead. The problem we face currently in our environment is whenever we need to install ESXi on several servers of the same hardware, it becomes tedious to have several cds of the same image for the installations.

    Thanks!!

    David

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: