215

Experts. I've successfully installed VMware tools for Ubuntu. Everything seems to work fine, but shared folders were not mounted automatically.
How do I get them to work?

If I run vmware-hgfsclient in terminal, I get the list of shared folders, but ls -l /mnt/hgfs is empty. Actually there's no hgfs dir in /mnt. I know I should probably use the vmware-hgfsclient tool, but I realy don't know how.

P.S. I wouldn't ask if I could understand the vmware-hgfsclient help I've read.

Any suggestions?

Braiam
  • 69,112
V-Light
  • 2,273

14 Answers14

235

Most other answers are outdated. For Ubuntu 18.04 (or recent Debian distros), try:

sudo vmhgfs-fuse .host:/ /mnt/hgfs/ -o allow_other -o uid=1000

If the hgfs directory doesn't exist, try:

sudo vmhgfs-fuse .host:/ /mnt/ -o allow_other -o uid=1000

You may have use a specific folder instead of .host:/. In that case you can find out the share's name with vmware-hgfsclient. For example:

$ vmware-hgfsclient
my-shared-folder
$ sudo vmhgfs-fuse .host:/my-shared-folder /mnt/hgfs/ -o allow_other -o uid=1000

If you want them mounted on startup, update /etc/fstab with the following:

# Use shared folders between VMWare guest and host
.host:/    /mnt/hgfs/    fuse.vmhgfs-fuse    defaults,allow_other,uid=1000     0    0

I choose to mount them on demand and have them ignored by sudo mount -a and the such with the noauto option, because I noticed the shares have an impact on VM performance.

Requirements

Software requirements may require installing the following tools beforehand:

sudo apt-get install open-vm-tools open-vm-tools-desktop

Others have claimed the following are required:

sudo apt-get install build-essential module-assistant \
  linux-headers-virtual linux-image-virtual && dpkg-reconfigure open-vm-tools

Official Article

How to configure VMware Tools Shared Folders Linux mounts (60262)

Hrishikesh Kadam
  • 359
  • 5
  • 14
con-f-use
  • 19,041
109

I have set up on Windows 7 host with Ubuntu 11.04 Desktop with VMware Tools installed on.

Virtual Machine settings

  • Folder sharing = Always Enabled
  • Make sure you have at least one Folder shared between the host and guest

On the Ubuntu Guest

  • check /mnt/hgfs that you can access your shared folder.

    If you don't see your shared folders (automounted) inside /mnt/hgfs , run VMware configuration tools:

    sudo vmware-config-tools.pl

  • update your fstab using the details below:

    gksu gedit /etc/fstab

    (I am using ubuntu desktop so use other text editor to enter the next line at the end of the file)

    .host:/{shared-folder} /{path-to-mount-on} vmhgfs defaults,ttl=5,uid=1000,gid=1000 0 0

  • Restart your vm (You may need to restart few times or get error message saying unable to mount just skip the error and restart)

37

run vmware-config-tools.pl, AGAIN!

Refer: http://www.laotudou.com/vmware-player-share-folder.html

William
  • 936
ltd911
  • 371
19

[UPDATE 2017-05-18] This answer is outdated for Ubuntu newer than 15.10 (Wiley). The executable vmware-hgfsmounter has not been available in Ubuntu since 16.04LTS (xenial). Although, hgfsmounter may still be available on other Linux distributions, since the hgfsmounter function is still currently available in the upstream source code on GitHub. If anyone has updated information, please comment or edit this answer, instead of down-voting, as I believe this answer may still be valid for older Ubuntu releases.

This answer also assumes that you are not using VMWare Tools from VMWare but instead using open-vm-tools from your Linux distribution. VMWare decided to support this switch in 2015. See KB2073803. Therefore this answer also assumes that your version of Ubuntu can install the open-vm-tools from it's software repository.

OUTDATED FOR UBUNTU > 15.10 (Wiley)

This worked for me using open-vm-tools from Ubuntu Software Center (trusty-14.04LTS shown - please see update above):

cd /mnt
sudo mkdir hgfs
sudo vmware-hgfsmounter .host:/`vmware-hgfsclient` /mnt/hgfs

assuming of course that I had already enabled a shared folder from the host machine in VMware Player settings.

Note that vmware-hgfsclient returns the list of shared folders that are enabled in the VMware Player settings. This function is available for both open-vm-tools and vmware-tools.

Also note that vmware-hgfsmounter is equivalent to

mount -t vmhgfs .host:/win7share /mnt/hgfs

or to adding to your /etc/fstab file

.host:/win7share /mnt/hgfs vmhgfs defaults 0 0

But the vmware-hgfsmounter function is not available using the official vmware-tools from VMware that ships with the current VMware player. Therefore, as the currently accepted answer suggests, running the vmware-config-tools.pl -d fixes the problem.

9

I had a similar problem. The folder /mnt/hgfs/ appeared back again when I assured that open-vm was uninstalled. As follows

sudo apt-get purge open-vm-tools
sudo apt-get purge open-vm-tools-dkms

and reinstalled vmware-tools

Jason
  • 105
Peretz
  • 667
7

I had this exact problem. It turned out IT had installed some old version of VMWare tools with non-functioning vmhgfs kernel module.

My solution was to run the configuration with the clobber-kernel-modules setting to overwrite the existing vmhgfs module.

 sudo vmware-config-tools.pl -d --clobber-kernel-modules=vmhgfs

The -d selects all the defaults for you (remove it if you don't want the defaults).

jobin
  • 28,567
extabgrad
  • 391
6

open-vm-tools would NOT build kernel modules until I first installed linux-headers-virtual (paired with linux-image-virtual of course). as soon as I installed the headers package, dpkg-reconfigure open-vm-tools resulted in successfully building and loading the kernel modules, specifically the vmhgfs module.

pjs
  • 61
  • 1
  • 1
6

vmware-tools-patches worked for me; give this a shot if nothing else works

I've tested this on a fresh install (easy install) of ubuntu 16.10 on vmware workstation 12 pro

  1. Go to https://github.com/rasa/vmware-tools-patches
  2. Follow the Quickest Start instructions given there. Reproduced here:

    $ git clone https://github.com/rasa/vmware-tools-patches.git
    $ cd vmware-tools-patches
    $ ./patched-open-vm-tools.sh
    
Elder Geek
  • 36,752
5

I've been having the same problem but I think I have just been able to make some progress.

Type vmware-hfgs and then press the <Tab> key which will show you that there is also a vmware-hgfsmounter command. If you call that without any options it will print some help that shows you how to call this as part of the `mount' command. Using that info I then ran the following which worked for me:

cd /mnt
sudo mkdir win7share
sudo mount -t vmhgfs .host:/win7share /mnt/win7share

I was then able to access the Win 7 share and copy files to and from there.

If you want to make this permanent then I suspect that you will need to edit the /etc/fstab file but I can't help you there yet.

snth
  • 160
4

You need to install the VMWare tools first, after that the vmware-config-tools can be used globally. For a more detailed guide, you can see here.

stephenmyall
  • 9,885
3

(applies to Mac VMware Fusion and Ubuntu file sharing) When you are asked in vmware-config-tools.pl about whether you want HGFS, say yes! (The default is 'no' and you may have skipped over it when hitting enter). This should give you /mnt/hgfs after the tools are installed.

jobin
  • 28,567
3

If you can't still mount shared folders after installing vmware-tools, here is the resolution.

Previously, I couldn't mount windows shared folder after installing vmware tools. I didn't see any folders under /mnt/hgfs.

Finally, I got resolved this share folder mounting issue by installing open-vm-dkms.

Here are steps:

  1. Ensure configured shared folder in VMWare Player

  2. Install open-vm0dkms:

    sudo apt-get install open-vm-dkms
    
  3. Hit the "Enter" all the way to allow default value

  4. Mount Windows shared folder to Ubuntu VM:

    sudo mount  -t  vmhgfs  .host:/     /mnt/hgfs 
    
  5. check if mounting is successful

    df -kh
    

    You should see:

    .host:/         57657252 50247088   7410164  88% /mnt/hgfs
    

    Also check again if any folders under /mnt/hgfs. You should see folders under which.

  6. Auto mount shared folder on startup

    There is a startup script called “open-vm-tools” with in /etc/init.d/ folder. Just add the below line in the start function.

    sudo mount  -t  vmhgfs  .host:/     /mnt/hgfs
    

Hope it can help.

Eric Carvalho
  • 55,453
1

VMWare: 15.5.0 build-14665864
Windows 10 host, guest OS in the virtual machine; Ubuntu 20.04

$ tail -n 1 /etc/fstab 
vmhgfs-fuse     <-fill-in-echo-$HOME-here>/shares fuse    defaults,max_write=32768,allow_other         0    0
$ mkdir -p $HOME/shares && sudo mount shares

Make sure that the fstab line has max_write defined as above
( I had trouble with higher values,
  you might even be safer with 32767 as that is the highest possible value in 15 bits )
.

The name of the folder you have defined as "share" in VMWare settings (for the current VM) will appear as a sub-folder in ~/shares/ .

(Windows 10 host, used here - when this was found to be necessary)

Hannu
  • 6,605
  • 1
  • 28
  • 45
0

A workaround for this problem is to edit 'inode.c' and change the line '888' to remove 'compat_truncate' function call (that is responsible for this problem on kernels 3.8.x). This file is inside 'vmware-tools-distrib', so you need to perform the following steps:

Extract VMWare-Tools (probably you will get a folder called vmware-tools-distrib). Then:

 cd /vmware-tools-distrib/lib/modules/source
 tar xf vmhgfs.tar
 cd vmhgfs-only/
 sudo gedit inode.c

Go to line 888:

 result = compat_vmtruncate(inode, newSize);

And change it to:

 result = 0;

Then save the file and exit gedit.

 cd ..
 rm -rf vmhgfs.tar
 tar cf vmhgfs.tar vmhgfs-only/
 rm -rf vmhgfs-only/

Now restart the installing procedure. It worked for me in Xubuntu 13.04.

Src: http://ubuntuforums.org/showthread.php?t=2136277&page=4&p=12709627#post12709627