Sunday, November 6, 2016

Mounting Shared Directory at the Host using Open VM Tools

Open VM Tools is a user space tools for Linux virtual machines. To mount a directory shared by the host to a VMware Linux guest, we can use vmhgfs-fuse.

First, we can figure out what has been shared at the host to the guest Linux system using vmware-hgfsclient, which is simply to enter the command in the Linux guest.

     vmware-hgfsclient

Assume that the output is shared_foo and we want to mount it at /mnt/hgfs/foo at the guest Linux system, we can run the following command at the Linux guest,

     vmhgfs-fuse .host:/shared_foo /mnt/hgfs/foo

To mount the directory at the boot time, we can add a line similar to the following to the /etc/fstab at the Linux guest,

     .host:/shared_foo /mnt/hgfs/foo fuse.vmhgfs-fuse allow_other 0 0

You can also add different mounting options. For instance, in the following, the shared directory will be shown as owned by user foo_user and group foo_group, and with umask=022 applied.

     .host:/shared_foo /mnt/hgfs/foo fuse.vmhgfs-fuse allow_other,uid=foo_user,gid=foo_group,umask=022 0 0

3 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. "mount -t vmhgfs .host:/hostshare /mnt/hostshare" for some reason returns "Error: cannot mount filesystem: No such device"
    Your recipe is working. Thank you very much)

    ReplyDelete
    Replies
    1. Perhaps, use vmware-hgfsclient to figure out the name of the share?

      Delete