# VMware shared folders



## emosms (Jan 14, 2010)

Anyone running a virtual FreeBSD via VMWare?
I have a guest FreeBSD and WinXP host.
Running the VM through VMWare and have installed vmware tools.
I enabled shared folders and try to mount the shared folders.
Cant find into the documentation explicitly stated, that this feature works for FreeBSD guest.
So according to the instructions I followed: 
*Permissions and Folder Mounting for Shared Folders on Linux Guests*
When type:

```
mount -t vmhgfs .host:/ /home/user1/shares
```
I get:

```
mount: .host/ : Operation not supported by device
```


----------



## pol (Feb 10, 2011)

Hi. I'm running FreeBSD 8.2-PRERELEASE i386 on VMware Workstation 6.5.5 (Win7 x64) with working Share Folders feature.

I used the current port emulators/open-vm-tools-nox11. Including the use of shared folders in the virtual machine configuration, added a shared directory on the host, on the guest executed the mount command: [cmd=]mount -t vmhgfs .host: /mnt[/cmd] And you're done.


----------



## tuaris (Jul 13, 2018)

Hate to post to an old thread, but it comes up as one of the first results in a web search.
The mount command given above no longer works.  The correct approach (tested in 11.1) is to run the following as root:


```
pkg install open-vm-tools

SHARE_NAME=edit_as_needed
mkdir /mnt/${SHARE_NAME}
vmhgfs-fuse .host:/${SHARE_NAME} /mnt/${SHARE_NAME}
```

The above will only allow root access to the shared folder.  To allow for other users add in the *-o allow_other* option, and if you want a user id:


```
vmhgfs-fuse -o allow_other -o uid=XXXX .host:/${SHARE_NAME} /mnt/${SHARE_NAME}
```


----------



## joggx (Dec 25, 2018)

how to mount it in /etc/fstab?


```
.host:/ /mnt/share/ vmhgfs-fuse defaults,allow_other,uid=1000 0 0
```

it says 'Inappropriate file type or format'.


----------



## T-Daemon (Dec 25, 2018)

Is the fuse kernel module loaded?


----------



## joggx (Dec 25, 2018)

Yes I can mount it manually. I tried 'vmhgfs' too.


----------



## T-Daemon (Dec 26, 2018)

Try this:

/etc/fstab

```
.host:/ /mnt/share/ vmhgfs mountprog=/usr/local/bin/vmhgfs-fuse,defaults,allow_other,uid=1000 0 0
```

From mount(8)

```
mountprog=<program>
             Force mount to use    the specified program to mount the
             file system, instead of calling nmount(2) directly.  For
             example:

             mount -t foofs -o mountprog=/mydir/fooprog    /dev/cd0 /mnt
```


----------



## Sebastian (Oct 9, 2019)

Does anyone solved this issue ? I'm not able to get it working. Seems to be a bug , but I don't know if this is related to freebsd or Vmware tools ?


----------



## GVitaliy (Oct 11, 2019)

Hello, I apologize for my English. I have a similar problem. Thanks to the information from this forum, I was able to partially advance in its solution.

I have:

Host - Win 7 64bit
Guest - FreeBSD 12.0 + KDE5
open-vm-tools 10.3.0_1,2 installed.

Two shared folders named `[I]LShare[/I]` and `[I]HVideo[/I]` have been created.

Create a directory (container) to mount the shared folders:


```
sudo mkdir /mnt/HostShare/
```

After running the command:


```
sudo vmhgfs-fuse -o allow_other -o uid=1001 .host:/ /mnt/HostShare
```


```
$ cd /mnt/HostShare
$ ls -l
total 32
drwxrwxrwx  1 vitaliy63  wheel  8192 10 окт.  08:53 HVideo
drwxrwxrwx  1 vitaliy63  wheel  8192 11 окт.  20:14 LShare
```

the `[I]HostShare[/I]` directory contains mounted shared folders and you can work with them.


```
$ mount
/dev/da0p2 on / (ufs, local, journaled soft-updates)
devfs on /dev (devfs, local, multilabel)
/dev/da0p4 on /var (ufs, local, journaled soft-updates)
/dev/da0p5 on /tmp (ufs, local, journaled soft-updates)
/dev/da0p6 on /usr (ufs, local, journaled soft-updates)
procfs on /proc (procfs, local)
/dev/fuse on /mnt/HostShare (fusefs, local, synchronous)
```

The problem is that to get the same thing using *fstab*.

I tried different options:

And so


```
.host:/ /mnt/HostShare/ vmhgfs-fuse defaults,allow_other,uid=1001 0 0
```

And so


```
.host:/ /mnt/HostShare/ vmhgfs mountprog=/usr/local/bin/vmhgfs-fuse,defaults,allow_other,uid=1001 0 0
```

And so


```
.host:/ /mnt/HostShare/ vmhgfs-fuse mountprog=/usr/local/bin/vmhgfs-fuse,defaults,allow_other,uid=1001 0 0
```

The result is the same-the `[I]HostShare[/I]` directory is empty.

How to make it work using the *fstab*?


----------



## Sebastian (Oct 11, 2019)

Manual mouting with vmhgfs-fuse. Works for me as well, but if I try to mount fuse via fstab I'm getting an syntax error. 

Do you get an error ? 

I could only find fstab syntax for linux , but none of them are working :/ .


----------



## T-Daemon (Oct 12, 2019)

T-Daemon said:


> .host:/ /mnt/share/ vmhgfs mountprog=/usr/local/bin/vmhgfs-fuse,defaults,allow_other,uid=1000 0 0





GVitaliy said:


> .host:/ /mnt/HostShare/ vmhgfs-fuse mountprog=/usr/local/bin/vmhgfs-fuse,defaults,allow_other,uid=1000 0  0


To correct myself in post #7, set in /etc/fstab  as FStype *fuse*:

```
.host://mnt/HostShare/ *fuse* mountprog=/usr/local/bin/vmhgfs-fuse,defaults,allow_other,uid=1001
```
The `uid=1001` is not  necessary, unless the intention is to give explicitly to that user ownership, but with the `allow_other` option set, permission to read, write, execute is granted to everyone.


----------



## GVitaliy (Oct 12, 2019)

I tried:


```
.host://mnt/HostShare/ fuse mountprog=/usr/local/bin/vmhgfs-fuse,defaults,allow_other 0 0
```

But the `HostShare` directory is still empty. And in the process of restarting the screen among other lines runs an error message - `fstab: /etc/fstab:8: Inappropriate file type or format`.

My /etc/fstab


```
# Device    Mountpoint  FStype      Options     Dump  Pass#
/dev/da0p2  /           ufs   rw    1     1
/dev/da0p3  none        swap  sw    0     0
/dev/da0p4  /var        ufs   rw    2     2
/dev/da0p5  /tmp        ufs   rw    2     2
/dev/da0p6  /usr        ufs   rw    2     2
proc        /proc       procfs      rw    0     0
 .host:/           /mnt/HostShare/   fuse  mountprog=/usr/local/bin/vmhgfs-fuse,defaults,allow_other    0     0
```

Additional information:


```
$ vmhgfs-fuse -e

failed to open /proc/filesystems 2
failed to open /lib/modules/12.0-RELEASE-p10/modules.dep 2
SysCompatCheck: failed FUSE install checks
vmhgfs-fuse: 2 - HGFS FUSE client needs FUSE environment
```


```
$ kldstat

Id Refs Address                Size Name
 1   46 0xffffffff80200000  243d228 kernel
 2    1 0xffffffff8263f000    10c70 tmpfs.ko
 3    3 0xffffffff82650000     8a00 libiconv.ko
 4    1 0xffffffff82659000    16750 fuse.ko
 5    1 0xffffffff82670000     1108 cd9660_iconv.ko
 6    1 0xffffffff82672000     37f8 libmchain.ko
 7    1 0xffffffff82676000     1118 msdosfs_iconv.ko
 8    1 0xffffffff82b12000     27b0 vmmemctl.ko
 9    1 0xffffffff82b15000     23f0 vmxnet.ko
10    1 0xffffffff82b18000     2ed8 vmblock.ko
11    1 0xffffffff82b1b000     2678 intpm.ko
12    1 0xffffffff82b1e000      b10 smbus.ko
13    1 0xffffffff82b1f000     1800 uhid.ko
14    1 0xffffffff82b21000    39970 linux.ko
15    2 0xffffffff82b5b000     2e28 linux_common.ko
16    1 0xffffffff82b5e000    33c60 linux64.ko
17    1 0xffffffff82b92000      acf mac_ntpd.ko
```


----------



## Sebastian (Oct 12, 2019)

Does it work for you T-Daemon ?

For me it does not.


```
.host:/ /mnt/ fuse mountprog=/usr/local/bin/vmhgfs-fuse,defaults,allow_other,uid=1001
/etc/fstab: 16 lines, 1223 characters.
# mount -a
fstab: /etc/fstab:16: Inappropriate file type or format
```




```
# vmhgfs-fuse -e
failed to open /proc/filesystems 2
failed to open /lib/modules/12.0-RELEASE-p10/modules.dep 2
SysCompatCheck: failed FUSE install checks
vmhgfs-fuse: 2 - HGFS FUSE client needs FUSE environment
```


```
uname -a
FreeBSD salty 12.0-RELEASE-p10 FreeBSD 12.0-RELEASE-p10 GENERIC  amd64
```


----------



## _martin (Oct 12, 2019)

When you mount the vmhgfs on system vmhgfs-fuse daemon keeps running. Due to this I'd avoid having this FS in /etc/fstab. IMO autofs is a better place to put it in.

On Linux it's pretty straight forward, my entry in /etc/auto.direct:

```
/in    -fstype=fusefs,subtype=vmhgfs-fuse,allow_other .host:/incoming
```

On FreeBSD it's a problem because there's no mount_vmhgfs. There's mount_fusefs but it seems there's no option (that would be specified with -o) to specify subsystem, or in its naming convention: "fuse daemon".

The best I came up with is:  `mount_fusefs /dev/fuse /in vmhgfs-fuse .host:/incoming`. Fuse daemon is specified after mount point. I was not able to specify these options in autofs map (or fstab for that matter).


----------



## _martin (Oct 12, 2019)

I played around a bit more with this but failed to mount the share using /etc/fstab. But mountprog option does work with autofs:

/etc/auto.direct:

```
/in     -fstype=fusefs,mountprog=/usr/local/bin/vmhgfs-fuse .host:/incoming
```


----------



## GVitaliy (Oct 13, 2019)

Can consider the problem from the other side? There is a working manual mount command –


```
sudo vmhgfs-fuse -o allow_other -o uid=1001 .host:/ /mnt/HostShare
```

But you have to enter it every time you log in.  Maybe there is a way to shorten/speed up this process? For example, using aliases, scripts, etc.

I'm still just starting to learn FreeBSD and I haven't mastered many things yet. For example, regarding autofs.
How to use it in my case?

What does the `incoming` parameter in the string mean

```
/in     -fstype=fusefs,mountprog=/usr/local/bin/vmhgfs-fuse .host:/incoming
```

and how does this link to my `/mnt/HostShare`?

 And I don't have a file /etc/auto.direct


----------



## _martin (Oct 13, 2019)

The example I showed is regarding my setup. incoming is my shared folder on host. /etc/auto.direct is one of the common maps used in autofs and needs to be created. As it was not concern of this thread I didn't show the whole configuration. I can if you want. But I did find a problem with this setup - once automount unmounts the share it doesn't automatically mounts it back. So I don't consider this as good enough solution. 

Yes, you can put this into an official script, e.g. /etc/rc.local. You can read more about it in the rc(8) page. Create the file if it doesn't exist and put this there:

/etc/rc.local

```
/usr/local/bin/vmhgfs-fuse .host:/ /mnt/HostShare -o allow_other -o uid=1001
```
This share will be mounted during boot then. It's not what OP is asking, but it's certainly one way of doing it.


----------



## T-Daemon (Oct 13, 2019)

@ GVitaliy, I wouldn't dismiss the persistent mount by /etc/fstab yet. There are more option to try.
For example: How to configure VMware Tools Shared Folders Linux mounts. The description is for linux, but there is no reason not to try.

@ Sebastian


Sebastian said:


> Does it work for you T-Daemon ?


Actually I do not have a VMware installed FreeBSD guest system. I made the suggestion on a assumption, based on past experiences with other fuse-based filesystems.


----------



## _martin (Oct 14, 2019)

I used gdb and had little fun tracing mount around to see what's happening during mount. It was in fstabscan() where I saw the light.

If you insist to have it in fstab I strongly suggest you to use failok to avoid headaches during boot.
To have these shares in fstab you have to do this:


```
.host:/        /mnt/hgfs    fusefs  rw,mountprog=/usr/local/bin/vmhgfs-fuse,allow_other,failok 0 0
```

GVitaliy change the mountpoint to your desired location.


----------



## Sebastian (Oct 14, 2019)

Thank you _martin . With your provided syntax I'm able to create the mount point inside fstab without any syntax error. But even with your provided syntax, mounting does not work without typing mount -a after a rebooting the vm.


----------



## _martin (Oct 14, 2019)

Sebastian said:


> But even with your provided syntax, mounting does not work without typing mount -a after a rebooting the vm.


It does work for me. Do you have fuse module loaded ? fuse_load="YES" in /boot/loader.conf.


----------



## jwolfe (Oct 14, 2019)

Thanks _martin.

I have shared your solution to an identical query on https://github.com/vmware/open-vm-tools/issues/374


----------



## GVitaliy (Oct 14, 2019)

Thank you _martin. for your help, finally everything worked. After entering a string in fstab:


```
.host:/        /mnt/HostShare    fusefs  rw,mountprog=/usr/local/bin/vmhgfs-fuse,allow_other,failok 0 0
```

I get:


```
$ cd /mnt/HostShare
$ ls -l
total 32
dr-xr-xr-x  1 root  wheel  8192 13 окт.  17:01 HVideo
drwxrwxrwx  1 root  wheel  8192 14 окт.  19:58 LShare
```

But there are a few things –

I can see the difference in the permissions, but I understand it depends on the permissions on the host?

If I remove the file from `LShare` it is placed in the basket. And if then, opening the basket I choose restore option, I get an error message –


```
Mistake – Dolphin ?

Not enough free disk space to record
«file:///home/vitaliy63/.local/share/Trash/files/Лист Microsoft Excel.xlsx».
```

You can only be removed from the Recycle Bin.

Is it possible to somehow fix?


----------



## jdb2 (Jan 5, 2020)

Sorry to reply to such an old thread, but I'm having the same problems and nothing in this thread has worked for me. I have FreeBSD 12.1 x64 running under VMware Workstation 15 Pro 15.5.1 build-15018445 , which is itself running on top of Linux Mint 19.2 Cinnamon 64-bit on an Intel NUC8i7BEH.

The manual fuse mount sort of "works" in that it doesn't initially fail, but, when I navigate to my "/mnt/freebsd-share" directory and do an ls I get an error about freebsd-share missing :


```
$ cd /mnt
$ ls
ls: freebsd-share: No such file or directory
$
```

Any help would be appreciated.

Thanks,

jdb2


----------



## _martin (Jan 6, 2020)

jdb2 I've tested my solution now on 
	
	



```
FreeBSD fbsd12i 12.1-RELEASE FreeBSD 12.1-RELEASE r354233 GENERIC  i386
```
 and it works just fine. I did the OS update from 12.0 VM I was using when I was helping here to solve the problem so I didn't have to change anything from configuration point of view.

Check for the same issues I've already mentioned in this thread (proper modules are loaded, config is ok,etc..).


----------



## peterwjsinclair (Jan 20, 2020)

I am running FreeBSD 12.1 RELEASE on VMware Fusion 11.5.1 on macOS Catalina 10.15.2. After installing open-vm-tools, I added fuse_load="YES" to /boot/loader.conf and the following line to /etc/fstab (psinclai is my MacBook host share and I set my uid to be the same on the FreeBSD VM as on the Mac). This works consistently now.

.host:/psinclai /mnt/korell    fusefs  rw,mountprog=/usr/local/bin/vmhgfs-fuse,allow_other,uid=501 0 0

I also had to add the xf86-video-vmware package to get the right screen resolution once I installed xorg and gnome3.


----------



## kim.bjoern (Feb 3, 2021)

...and I can confirm that in my /etc/fstab:



```
.host:/        /mnt/HostShare    fusefs  rw,mountprog=/usr/local/bin/vmhgfs-fuse,allow_other,failok 0 0
```
works with FreeBSD 12.2-RELEASE-p3 (xigmanas-full) and VMware Fusion 12.1

with a minor warning though:



```
df: File system /mnt/HostShare does not have a block size, assuming 512.
/dev/fuse                      233G     28G    204G    12%    /mnt/HostShare
```

Thanks - Kim Bjoern


----------

