August 29, 2007

VMware fast file transfer from host

Yet another instance of the readily apparent solution not being the optimal solution.

I always used SFTP to transfer files from the host machine to the virtual machine over the emulated ethernet hardware. This is very stupid, and I had always recognized it. I wondered why VMware server console didn't have a feature to transfer files from the host machine to a virtual disk — it was apparent that it could load local file-like things into "virtual space" from the VMware tools installation mechanism, but a few (poorly formulated) Google searches turned up little information on alternatives. [*]

Today I "sank the battleship", however, and found the search term that got me the hit I was looking for. There's a tool to mount your VMware-format virtual machine disk via the .vmdk file — on UNIX, it's vmware-mount.pl. Here's a short explanation on how to use it:

  1. If you're in an environment where you can't easily spawn new shells, you should probably run screen or something similar.

  2. vmware-mount.pl -p my_disk.vmdk # Prints out the partitions on the disk.

  3. sudo vmware-mount.pl my_disk.vmdk 1 /mnt/vmware_disk # Mounts the first partition in the specified directory

Pretty straighforward. If you're running any kind of recent kernel it spits out this saddening message::

It has been reported that this program does not work correctly with 2.4+ Linux kernels in some cases, and you are currently running such a kernel. Do you really want to continue? [N]

You also seem to get one of these if you're running it for the first time::

There is no Network Block Device defined on this machine. This script is about to create the /dev/nb0 Network Block Device. Continue? [Y]

In the end, it gives you this nice message::

Using another terminal, you can now browse your Virtual Hard Disk partition in /mnt/vmware_disk/. Hit Control-C in this terminal when done.

Thanks for giving us plenty of prior notice, VMware. :P If you can't spawn a new shell at this point and ignored my warning above, background the job with a Control-Z, then bg (in bash). To stop the mount after backgrounding the job, type fg, then Control-C.

If you hit Control-C multiple times, it seems that you get to find out about the developer's back problems::

It seems like somebody unmounted the /mnt/vmware_disk/ mount point in my back. I was about to do it anyway.

Footnotes

[*]

There's a pretty well established notion in search technologies: it's hard to find information that you don't know how to describe. For this reason search developed things like inverted file systems and lexical analysis methods, which garner what you're looking for from related terms that you do have some concept of.