Mount Flat VMWare Disk Images Under Linux

Cromoteca

I use a VMWare virtual machine to run my favorite software anywhere. It is a very nice solution, nevertheless when I run it at home I feel quite frustrated for not being able to run it on real hardware.

The easiest solution is to mount it as a local drive and access files from a real Linux installation. VMWare server provides a tool to mount vmdk files, but I don't want to install it just to be able to use that command.

Fortunately, I'm using a flat VMWare image, and this makes possibile to mount the image vithout any special tool. After all, the flat vmdk file is just a raw image of the disk, so you just need to use it as a loopback device.

Let's assume that the disk image is located at /diskimage-flat.vmdk (quite unlikely, but it's OK for an example) and that there are no other loopback devices in use (i.e. /dev/loop0 and /dev/loop1 are free). The needed commands would be:

losetup /dev/loop0 /diskimage-flat.vmdk
losetup -o 32256 /dev/loop1 /dev/loop0
mount /dev/loop1 /mnt/diskimage

The offset in the second command might change for a different virtual disk (although I don't tink so if you want to mount the first partition). To check it, run the first command, then use fdisk on the first loopback device:

losetup /dev/loop0 /diskimage-flat.vmdk
fdisk -l /dev/loop0

The offset is the start of the partition per the number of bytes per sector (63*512 in my case).

Comments

Comments are moderated to avoid SPAM.

Languages

Top Level Menu

Section Menu

News

MeshCMS 3.4.1
(Nov 6, 2008)
MeshCMS 3.4.1 has been released to fix the issue with Tomcat 6.0.18 and 5.5.27. MeshCMS 3.5 is still under development.
Contributed Modules
(Sep 2, 2008)
Additional MeshCMS modules contributed by the community are available in a dedicated page.

Donate to MeshCMS

Support This Project