Thursday, October 09, 2014

Running ESXi 4.1 on Old Hardware

I was having problems with my (ancient) storage server and thought to myself how convenient it would be if the hardware was running ESX and I could remotely view the console output.  So, I started down the path of seeing what was possible.

It was previously running a flavor of Ubuntu, so I SSH'd into the system and checked out what kind of processor I was running:

clutzer@storage:~$ cat /proc/cpuinfo 
processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 15
model           : 5
model name      : AMD Opteron(tm) Processor 250
stepping        : 10
microcode       : 0x3a
cpu MHz         : 2390.227
cache size      : 1024 KB
physical id     : 0
siblings        : 1
core id         : 0
cpu cores       : 1
apicid          : 0
initial apicid  : 0
fdiv_bug        : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext 3dnowext 3dnow constant_tsc tsc_reliable nonstop_tsc hypervisor
bogomips        : 4780.45
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:

Whoa, AMD Opteron 250--cute little thing.  A quick Google search told me that people have had success running ESXi 4.1 with this chip, so off I went to download it.

The install of ESXi 4.1 was pretty smooth.  However, this CPU is so old that even though it's a 64 bit CPU, it's only able to emulate 32 bit guests.  Sigh, oh well.  I can live with that until it dies and I upgrade to a modern CPU.  After an install of ubuntu-12.04.5-server for i386, I came across my first stumbling block: how to give my VM direct access to physical drives that were previously used for my RAID5 array.

To make a long story short, it's doable, it's just not support intuitive.  To start out with, I gave the guest physical access to my old boot drive so that I could copy settings from my older 64 bit ubuntu server to my new 32 bit one.  First, SSH into the ESX host (you will have to enable SSH in order to do this.)  Then CD into the directory containing your guest VM:

~ # df -h
Filesystem                Size      Used Available Use% Mounted on
visorfs                   1.3G    259.7M   1023.1M  20% /
vfat                      4.0G      1.1M      4.0G   0% /vmfs/volumes/5436990b-f73b2f64-36c4-00e08140bfd8
vfat                    249.7M     88.5M    161.2M  35% /vmfs/volumes/c36ca674-6c8e9e4b-31cf-d40952c191b0
vfat                    249.7M      4.0k    249.7M   0% /vmfs/volumes/372be47d-3edc4952-48c6-d8f964e543d6
vfat                    285.9M    145.3M    140.6M  51% /vmfs/volumes/f57412e8-354f182d-35e2-275460791eb0
vmfs3                    51.0G     21.5G     29.5G  42% /vmfs/volumes/5436990c-a9311db3-960e-00e08140bfd8
~ # cd /vmfs/volumes/5436990c-a9311db3-960e-00e08140bfd8/
/vmfs/volumes/5436990c-a9311db3-960e-00e08140bfd8 # ls
Gateway Storage Server
/vmfs/volumes/5436990c-a9311db3-960e-00e08140bfd8 # cd Gateway\ Storage\ Server/

/vmfs/volumes/5436990c-a9311db3-960e-00e08140bfd8/Gateway Storage Server #

Then, the following magical command creates a passthrough VMDK that you can then add to your guest VM as if it were any other VM disk:

vmkfstools -r /vmfs/devices/disks/vml.010000000020202020202020202020202035514630435a4e56535433333030 host_sata_ST3300620A_5QF0CZNV.vmdk

/vmfs/volumes/5436990c-a9311db3-960e-00e08140bfd8/Gateway Storage Server # ls -l
-rw-------    1 root     root         1073741824 Oct  9 17:52 Gateway Storage Server-db289c96.vswp
-rw-------    1 root     root        21474836480 Oct  9 18:02 Gateway Storage Server-flat.vmdk
-rw-------    1 root     root               8684 Oct  9 17:34 Gateway Storage Server.nvram
-rw-------    1 root     root                483 Oct  9 15:18 Gateway Storage Server.vmdk
-rw-r--r--    1 root     root                  0 Oct  9 15:18 Gateway Storage Server.vmsd
-rwxr-xr-x    1 root     root               3013 Oct  9 17:51 Gateway Storage Server.vmx
-rw-r--r--    1 root     root                277 Oct  9 17:51 Gateway Storage Server.vmxf
-rw-------    1 root     root       300069052416 Oct  9 16:56 host_sata_ST3300620A_5QF0CZNV-rdm.vmdk
-rw-------    1 root     root                506 Oct  9 16:56 host_sata_ST3300620A_5QF0CZNV.vmdk
-rw-r--r--    1 root     root              35175 Oct  9 15:25 vmware-1.log
-rw-r--r--    1 root     root              27116 Oct  9 15:25 vmware-2.log
-rw-r--r--    1 root     root             101220 Oct  9 15:32 vmware-3.log
-rw-r--r--    1 root     root             133671 Oct  9 16:15 vmware-4.log
-rw-r--r--    1 root     root              78331 Oct  9 17:34 vmware-5.log
-rw-r--r--    1 root     root              74680 Oct  9 17:56 vmware.log

Next, using vSphere Client log into the ESX box, edit the guest VM settings and add an existing drive.  Then, from your guest VM, mount any partitions you are interested in and Voila, you have passed through a drive.

The following are some command lines I'm storing here for reference:

Old boot drive:
 vmkfstools -r /vmfs/devices/disks/vml.010000000020202020202020202020202035514630435a4e56535433333030 host_sata_ST3300620A_5QF0CZNV.vmdk

4 drive RAID-5 array:
vmkfstools -r /vmfs/devices/disks/vml.01000000002020202020202020202020203558573030583259535433313530 host_sata_ST31500541AS_5XW00X2Y.vmdk
vmkfstools -r /vmfs/devices/disks/vml.01000000002020202020202020202020203558573031334e30535433313530 host_sata_ST31500541AS_5XW013N0.vmdk
vmkfstools -r /vmfs/devices/disks/vml.01000000002020202020202020202020203558573031413841535433313530 host_sata_ST31500541AS_5XW01A8A.vmdk
vmkfstools -r /vmfs/devices/disks/vml.01000000002020202020202020202020203558573031444731535433313530 host_sata_ST31500541AS_5XW01DG1.vmdk