swisspig.net - To hell with the pig... I'm going to Switzerland.

Mounting VMWare VMDK Disk Without VMWare (Friday, September 7, 2007)

So I decided to upgrade my computer from the old and no longer supported Ubuntu 5.10 (Breezy Badger) to Ubuntu 7.04 (Feisty Fawn), and among the issues this caused, I found myself completely unable to use my old installation of VMWare. VMWare has always been rather cumbersome, and I'm looking for alternatives. The real trick is saving all the data that was stored in my virtual machines.

In looking for a way to rescue my data, I found many references to vmware-mount.pl, a utility provided by VMWare that requires you to have a working, licensed copy of VMWare. Of course, if you have that, you don't need the utility.

It turns out, that a VMDK file is actually just a raw disk image (much like /dev/hda, for example. You can't mount it directly, because it's a disk image, not a partition image. So what you need to do is figure out the offset of the partitions within the disk image.

Following the instructions of Jason Boxman, I used "fdisk -l -u -C 592 image.vmdk" to find the partition table, which showed (in my case) that sectors were 512 bytes, and that the first (and only) partition on the disk has an offset of 63 sectors, or 32,256 bytes.

Using that information, we can mount the partition with "mount -o loop,offset=32256 -t ntfs image.vmdk /mnt".

I don't think it's a good idea to try to use the image like this if you're planning on also using it in VMWare. If you want to be safe, then make sure to mount the image with the read-only option (ro).

—Brian (9/7/2007 3:53 PM)
(1 comments)

Comments

Great! Is a very useful tip. I use vmware-loop and vmware-mount.pl, but I have vmware-server of course.
Your mode is brilliant ;)
Thanks a lot.

-- Antonio Doldo (2/10/2008 5:53 AM)

Name
URL
Comment
(no html)
 

Disclaimer: Opinions on this site are those of Brian Ziman and do not necessarily
reflect the views of any other organizations or businesses mentioned.