VMware shared folders

emosms

Member


Messages: 38

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:
Code:
mount -t vmhgfs .host:/ /home/user1/shares
I get:
Code:
mount: .host/ : Operation not supported by device
 
Last edited by a moderator:

pol

New Member


Messages: 2

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

Active Member

Reaction score: 22
Messages: 181

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:

Bash:
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:

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

joggx

Member

Reaction score: 2
Messages: 40

how to mount it in /etc/fstab?

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

it says 'Inappropriate file type or format'.
 

T-Daemon

Daemon

Reaction score: 660
Messages: 1,366

Try this:

/etc/fstab
Rich (BB code):
.host:/ /mnt/share/ vmhgfs mountprog=/usr/local/bin/vmhgfs-fuse,defaults,allow_other,uid=1000 0 0

From mount(8)
Code:
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

Member

Reaction score: 5
Messages: 73

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

New Member

Reaction score: 1
Messages: 11

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:

Code:
sudo mkdir /mnt/HostShare/

After running the command:

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

Code:
$ 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.

Code:
$ 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

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

And so

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

And so

Code:
.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

Member

Reaction score: 5
Messages: 73

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

Daemon

Reaction score: 660
Messages: 1,366

.host:/ /mnt/share/ vmhgfs mountprog=/usr/local/bin/vmhgfs-fuse,defaults,allow_other,uid=1000 0 0
.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:
Rich (BB code):
.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

New Member

Reaction score: 1
Messages: 11

I tried:

Code:
.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

Code:
# 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:

Code:
$ 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

Code:
$ 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

Member

Reaction score: 5
Messages: 73

Does it work for you T-Daemon ?

For me it does not.

Code:
.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



Code:
# 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

Code:
uname -a
FreeBSD salty 12.0-RELEASE-p10 FreeBSD 12.0-RELEASE-p10 GENERIC  amd64
 

_martin

Aspiring Daemon

Reaction score: 217
Messages: 969

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:
Bash:
/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

Aspiring Daemon

Reaction score: 217
Messages: 969

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:
Code:
/in     -fstype=fusefs,mountprog=/usr/local/bin/vmhgfs-fuse .host:/incoming
 

GVitaliy

New Member

Reaction score: 1
Messages: 11

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

Code:
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
Code:
/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

Aspiring Daemon

Reaction score: 217
Messages: 969

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
Code:
/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

Daemon

Reaction score: 660
Messages: 1,366

_martin

Aspiring Daemon

Reaction score: 217
Messages: 969

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:

Code:
.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

Member

Reaction score: 5
Messages: 73

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

Aspiring Daemon

Reaction score: 217
Messages: 969

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.
 

GVitaliy

New Member

Reaction score: 1
Messages: 11

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

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

I get:

Code:
$ 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 –

Code:
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

New Member

Reaction score: 1
Messages: 2

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 :

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

Any help would be appreciated.

Thanks,

jdb2
 

_martin

Aspiring Daemon

Reaction score: 217
Messages: 969

jdb2 I've tested my solution now on
Code:
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..).
 
Top