Mounting LVM vmware disks

I’ve spent a couple of weeks trying to recover some data from an old vmware machine. I didn’t want to install vmware on my new OS, so I looked into the vmware-mount program. The documentation refers to vmware-mount.pl, but I couldn’t find that file at first. It looks like since VMWare 2.0, vmware-mount.pl and vmware-loop have been replaced by a single vmware-mount binary, which behaves slightly differently.

I initially had problems with vmware-mount from VMware-server-2.0.0-122956.i386.tar.gz. I was getting this error:

vmware-mount: error while loading shared libraries: libfuse.so.2: cannot open shared object file: No such file or directory

I saw other reports of the same error, but no solution. I was using vmware-mount from a 32bit build on a 64bit OS, so instead I tried the vmware-mount from VMware-server-2.0.1-156745.x86_64.tar.gz. Then I got an error along the lines of:

SSLLoadSharedLibrary: Failed to load library libcrypto.so.0.9.8:/usr/local/bin/libdir/lib/libcrypto.so.0.9.8/libcrypto.so.0.9.8: cannot open shared object file: No such file or directory
Core dump limit is 0 KB.
Child process 26541 failed to dump core (status 0x6).

VMware Server Error:
VMware Server unrecoverable error: (app)
SSLLoadSharedLibrary: Failed to load library libcrypto.so.0.9.8:/usr/local/bin/libdir/lib/libcrypto.so.0.9.8/libcrypto.so.0.9.8: cannot open shared object file: No such file or directory
Please request support.
To collect data to submit to VMware support, select Help > About and click “Collect Support Data”. You can also run the “vm-support” script in the Workstation folder directly.
We will respond on the basis of your support entitlement.

Press “Enter” to continue…

I read this. With a little guesswork this command seemed to do the trick:

sudo ln -s /lib /usr/lib/vmware

Now vmware-mount would list my partitions. First major breakthrough.

Mounting suspended disks

It complained that my virtual machine was in a suspended state, and so it wasn’t safe to mount the disk. I found I could bypass this problem by moving all the vmdk files into a separate directory. Then running vmware-mount in that directory. It effectively ignored all the vmware machine files, and used only the hard disk files.

mkdir vmdks
sudo mv *.vmdk vmdks/
cd vmdks

Now I could mount my /boot partition within the VM, but not the second partition because it was was an LVM container. A whole new problem to solve.

Mounting LVM volumes with vmware-mount

I stumbled on my buddy John’s post. That and this helped me figure out what was required.

My first step was to mount the disk flat, using a command like:

sudo vmware-mount -f pathToVMDK.vmdk /path/to/mount

That worked, sort of. With fdisk -l /path/to/mount I could see the two partitions. But sudo vgscan couldn’t find the lvm partition. I tried sudo losetup /dev/loop0 /path/to/mount/flat, but that didn’t work either.

I figured I needed vmware-loop to mount the partition as a loop device. I searched the VMware-server-2.0.1-156745.x86_64.tar.gz file for vmware-loop, but it was nowhere to be found. That’s when I started investigating with previous versions of VMWare. It looks like the 1.0.* releases included vmware-mount.pl and vmware-loop while the 2.0.* releases only include the new vmware-mount binary.

I downloaded VMware-server-1.0.9-156507.tar.gz. In that tar file I extracted bin/vmware-mount.pl and bin/vmware-loop. These were the files I needed. I skipped vmware-mount and went straight to vmware-loop. I was able to mount the second partition directly onto a network block device (/dev/dbd0) with:

sudo vmware-loop pathToVMDK.vmdk 2 /dev/nbd0

Now I could use the lvm commands to activate and mount my lvm. Note that vmware-loop is running the whole time, so I left it in a separate terminal. I closed it with CTRL-C at the very end of the process.

sudo vgscan
sudo vgchange -ay VolGroup00
sudo mount /dev/VolGroup00/LogVol00 /mnt/

Finally, I was able to copy the files from my virtual hard drive. I made a full backup with tar and then grabbed some other specific files and unmounted the whole thing.

sudo umount /mnt/
sudo vgchange -an VolGroup00

If you’re struggling with vmware-mount and  LVM or suspended disks, I hope this helps. Comments welcome.

Ubuntu is go

I have installed Ubuntu. It all seems to be running quite smoothly. VMWare is working, which is nice. I had some initial sound issues with Skype but it looks like it was a volume issue, sorted now. Waiting for Zend studio to download, hopefully that will be an easy install.

Overall, the process was rather painless. I’m loving synaptic package management. It really is much better than RPM. The desktop effects are taking a bit of getting used to. I can’t drag / drop windows onto the workspaces, but that’s not too big a deal.

So far, I’m pleased with the switch. For all you visual people, here’s a wee screenshot of the workspace switcher.

The desktop switcher on Ubuntu 8.04 Hardy

Some things that impressed me:

  • Media buttons “just work”, I can play / pause / forward / etc music, beautiful.
  • Installing copyright “questionable” plugins (MP3s, divx, etc) was painless and granny easy.
  • The windows key does stuff, out of the box, not very useful stuff, but still stuff!
  • I could import my pidgin, Evolution and something else data from Fedora. Nice.
  • Desktop effects are enabled out of the box (compiz for the techies).
  • Stuff prompts for configuration during install, for example ddclient. Handy.

I’m pleased I’ve switched over to Ubuntu. I’m a little wary that the #ubuntu channel is quite busy. Ubuntu seems to be popular with new linux users so there seem to be a lot of “newby” questions on there. Good they’re being answered, but it can be a pain for more experienced users.