I've had a bit of a problem today, I've taken a virtual disk image of two of my older machines, binning them and started to use the virtual machines on my nice new shiney laptop, however, sometimes I just want to reference some of the files, to have to boot the entire vritual machine, or open the visual VMWare Player software in order to mount the drive was a bit of a pain.
So, I set about looking at how to use "vmware-mount" the utility to let you mount drives in the command line. Here's my step by step guide to the activity, which I'm blogging as I've not got my little note book with me, and I want to keep this knowledge around for future use... So if it benefits anyone else out there, go you.
My host operating system is Ubuntu 10.04 LTS with VMWare Player 4.0.1 installed.
1. You first need a mount point, so we create one, with any name. I'm going to call mine "vdisk":
sudo mkdir /media/vdisk
2. Browse to the folder containing your vmdk image files, so I'm going to:
cd ~/virt/images
3. List the images there and make sure you have the name of the one you're going to use, mine is called "vista.vmdk", but it was called "vista 32bit.vmdk" and I noted that the command line tools, though supposedly supporting spaces in the filenames by wrapping everything in quotes actually worked better when I'd renamed the file without the spaces.
4. We need to know the partition within the disk image, so we perform:
vmware-mount -p ./vista.vmdk
You can substitute your filename or the whole path as you wish there, the output of this is the different logical partitions on the virtual disk image. For my example this gives two partitions, the first is the tiny Vista boot partition, the other is my working 130gb of data files, so I now know my partition to mount is in that file and its index is 2.
5. The actual mounting of the virtual image through the partition to the mount point we created:
sudo vmware-mount ./vista.vmdk 2 /media/vdisk
Voila, the image should mount and become accessible.
6. To unmount the image you can't just click on the desktop icon and unmount, nor use unmount itself, you must use vmware-mount once again. In my working I have been mounting multiple virtual images and then before logging off for the evening killing all the mounts, to do this perform:
sudo vmware-mount -x
All mounts should then drop.