Using VMware shared folders

Idea contributed by Ivan. Comments/bugs to Sam Kingston.

One way to access files on the host operating system from within the virtual machine is to use VMware's Shared Folders.

NOTE! There is an issue with stat()ing files on the hgfs file system - directory entries appear as 0 bytes. When testing your A0 implementation, do not attempt to ls files/directories on the hgfs file system or you will get incorrect sizes and may think your program is not working correctly.

First we need to shut down the VM guest and change some of its settings:

  1. Click: VM -> Settings -> Options -> Shared Folders. Add the folders you want to shared here.
  2. Click: VM -> Settings -> Add -> CD/DVD Drive -> Use physical drive -> Select auto detect and connect at power on.

Now install the VMware tools, which provides kernel support for interfacing with VMware from within a Linux guest:

  1. Start the virtual machine
  2. Get the latest version of the tools ISO: Click VM -> Install VMware tools -> Download
  3. Log in to a terminal in the VM and type the following commands:
  4. cd
  5. sudo mkdir /mnt/cdrom
  6. sudo mount /dev/cdrom1 /mnt/cdrom
  7. tar -xf /mnt/cdrom/*.tar.gz
  8. cd vmware-tools-distrib
  9. sudo ./vmware-install.pl
    Accept all default questions by pressing [Enter]. When the script asks if you want it to run the initialisation script, say yes and let it build the kernel modules. Say no when the script asks if you want to install the vmsync feature.
  10. sudo reboot

You may now remove the vmware-tools-distrib directory. The shared folders will be available in /mnt/hgfs.