There's various tools for Windows that allow you to mount VMware images, which offers a convenient way to transfer files to/from the Virtual Machine. The solution in linux seems to be a little less well-known, but it is effectve nonetheless, and I find it preferable to using SSH/FTP/NFS etc. to transfer files.

First you'll need to download a copy of VMware server, which is free. You may be using VMware player to run your virtual machines, but unfortunately it doesn't include the tool needed to mount VMware images. It's not a major problem though; just unpack the VMware server archive you just downloaded and copy the files "vmware-mount.pl" and "vmware-loop" from its "bin" directory to your /usr/bin directory (or whatever directory you have VMware Player installed). There's no need to install VMware Server if you already have Player. If you have neither installed then obviously you will need to install one of them. Now navigate to that installation directory and follow my lead:

jim@jim-desktop:/usr/bin$ ./vmware-mount.pl
This script requires 3 (not 0) mandatory argument(s).
Usage: ./vmware-mount.pl
-p : Print the partition table
disk : Name of the Virtual Hard Disk file
or
disk : Name of the Virtual Hard Disk file
partition : Number of the partition
[-t type] : Partition type
[-o options]: Partition mount options(s)
mount-point : Directory where to mount the partition

Here we see the usage instructions for the vmware-mount script. I'll run with the '-p' option so I can see the partition structure of my image:

root@jim-desktop:/usr/bin# ./vmware-mount.pl -p /home/jim/'My Virtual Machines'/windows.vmdk
--------------------------------------------
VMware for Linux - Virtual Hard Disk Mounter

Version: 1.0 build-44356

Copyright 1998 VMware, Inc. All rights reserved. -- VMware Confidential
--------------------------------------------
Nr      Start       Size Type Id Sytem
-- ---------- ---------- ---- -- ------------------------
1         63    2097088 BIOS  6 FAT16

That tells me that the partition number I'll need is 1, and it's the only partition available. So to mount the image I run the following:

root@jim-desktop:/usr/bin# mkdir /media/vmware-image
root@jim-desktop:/usr/bin# ./vmware-mount.pl /home/jim/'My Virtual Machines'/windows.vmdk 1 /media/vmware-image

The script warns you about untested support for kernels > 2.4 and has a whinge about network block devices, but type 'Y' on both counts to continue and the image will mount to your specified location (in this case, /media/vmware-image). You can now open another terminal window and explore the image. In Ubuntu w/ Gnome I'm able navigate via Nautilus, and it even creates a nice image on the desktop for me. You may find additional switches such as "-o ro" to make the image read-only will come in handy.

Comments

comments powered by Disqus