The easiest way to read or write files on a hard disk of a virtual machine is to start VMware Workstation, boot the virtual machine, then use a floppy disk drive or the network file system protocols (NFS, Windows File Sharing, etc.) to exchange data via your physical machine.
Sometimes, the amount of data you want to transfer is too large for a floppy, you don't have the appropriate driver to run the network inside the virtual machine, or you cannot run a virtual machine because your license has expired. For these reasons, you need a way to access the hard disk of the virtual machine directly from the host operating system, without having to run Workstation.
When the hard disk of the virtual machine is a raw device or a raw disk (see Installing an Operating System onto a Raw Partition from a Virtual Machine or Configuring Dual/Multiboot Systems to Run With Workstation), the problem is already solved: you can access the partition the same way you would access any other partition by first mounting it to a directory, then browsing the directory.
But when the hard disk of the virtual machine is a virtual disk (which is just a file when seen from your host operating system), you need the help of a program called vmware-mount.pl. This document describes how to use this program.
vmware-mount is a program that runs on the host operating system. It makes a virtual disk file appear as a hard disk to the operating system.
vmware-mount requires a Linux kernel version 2.1.101 or higher (including the stable 2.2.x series) because this version introduced the concept of network block devices, which is heavily used by vmware-mount. vmware-mount is available as an add-on to Workstation: for both evaluation users and licensed customers.
To install vmware-mount:
Assuming that your virtual hard disk file is ~/vmware/vhd.vmdk, follow these steps to read its contents using vmware-mount.pl:
This command returns output similar to the following:
--------------------------------------------
Workstation (for Linux)
- Virtual Hard Disk Mounter
Copyright (C) 1999 VMware, Inc.
--------------------------------------------
Nr Start Size Id System
-- -------- --------- -- -------------------This command results in output similar to the following:
--------------------------------------------
Workstation (for Linux)
- Virtual Hard Disk Mounter
Copyright (C) 1999 VMware, Inc.
--------------------------------------------
By using the vmware-loop binary directly, you can map the partition of a virtual hard disk to any network block device (which you can then mount). This mapping can be done in read-only mode if you use the -r command line option of vmware-loop.
Currently, a virtual hard disk cannot be accessed in read/write mode by more than one application at a time (Workstation or vmware-mount for example).
The following table describes issues and their potential resolutions.
Issue |
Resolution |
vmware-mount claims that the Linux kernel is too out of date. |
You need to upgrade to a newer kernel. The easiest way is to upgrade your Linux distribution (installing the package corresponding to the most recent kernel). If you are able, you can also grab the latest kernel sources and compile your own kernel. Take a kernel version 2.1.101 or higher and set the CONFIG_BLK_DEV_NBD option (which you can find under Block devices > Network block device support) to "y" or "m" If you don't want to mess with kmod (the kernel module loader formerly known as kerneld), we recommend to use "y". Once you have rebooted your new kernel, rerun background:red;vmware-mount.pl. |
vmware-mount keeps saying that it cannot open my virtual hard disk because it is locked by other virtual machines. What does that mean? |
vmware-mount.pl has detected that several applications (Workstation or other applications are trying to access your virtual disk at the same time. First, be sure that this is not true. If you are certain that two processes (including processes running on a remote machine) are not trying to simultaneously access your virtual hard disk, then it is probably a stale lock that has not been cleaned up as it should have been. You can remove it safely. If you experience further problems, please file an incident report at http://www.vmware.com/fileincident. Be sure to select the "vmware-mount" category, and to include the output of your session with your report. |
Under severe load, your host operating system may hang (lock solid) if you are writing to a virtual disk using vmware-mount.pl. VMware is aware of the problem and is working on a solution.
To avoid this problem, either use the read-only mode or try to limit the throughput of data you write to your virtual disk.
© 2001 VMware, Inc. All rights reserved.