Recover Un-mountable VMWare ESXi Volume

After upgrading to VMWare ESXi 5 from 4.1, I found one of my datastore volumes would no longer mount. The disk would show up as a device, but there were a series of errors whenever I tried to mount the volume.

After trying a variety of things, I still couldn’t get the volume to mount, so I decided to try to recover the virtual machines off the drive before wiping it.

The first step is to configure the un-mountable disk as a raw passthrough. This will allow a guest OS to access the disk. Instructions for these steps can be found here:

http://rand0mbits.blogspot.com/2010/12/esxi-raw-disk-pass-through.html

After converting the disk to a raw passthrough, assign it to a virtual machine on your ESXi host. I chose Gentoo Linux.

By default, most linux distributions don’t ship with VMFS support, however Christophe Fillot and Mike Hommey have developed a tool called vmfs-tools that allows mounting of VMFS partitions. If you have Debian or Ubuntu you can simply install the package. Since I was using Gentoo I had to build from source:

You may have to emerge some of the prerequisites if you do not have them. See the vmfs-tools site for details.

wget http://glandium.org/projects/vmfs-tools/vmfs-tools-0.2.1.tar.gz
tar -xf vmfs-tools-0.2.1.tar.gz
cd vmfs-tools-0.2.1
./configure
make && make install

Now that we have vmfs-fuse installed, we can mount our volume:

#Ensure the fuse kernel module is loaded
modprobe fuse

#Mount the device to the desired mountpoint
vmfs-fuse /dev/sdd1 /mnt/vmfs

#copy files off of mounted vmfs
cp -Rv /mnt/vmfs /tmp