New FreeBSD User - VirtualBox Shared Folders

I just installed FreeBSD on a VirtualBox guest just a couple of days ago. Are there any instructions out there for getting a shared folder that is on my Windows 10 host to work? Please advise. Thanks.
 
In order to mount those your OS needs to support the so called "vboxsf" filesystem, and therefor your OS needs to support Virtual Box. Look into emulators/virtualbox-ose-kmod for that. You might also want to install emulators/virtualbox-ose-additions.

After that you can simply follow the mount instructions shown within VirtualBox.
I already had virtualbox-ose-additions installed, but I did not have virtualbox-ose-kmod installed. I did that and rebooted my system. I then tried mount -t vboxsf Windows_share /mnt. I get "Operation not supported by device". Please advise. Thanks.
 
You may have installed the package, but did you also configure its contents? Installing a kernel module doesn't imply that FreeBSD will also actually load it. Either do that manually using kldload or automatically by adding it to /boot/loader.conf.

Either way, I mixed up my ports. The important port to install here is emulators/virtualbox-ose-additions, these are the official guest additions. After that you'll also have /boot/modules/vboxvfs.ko at your disposal which should give you access to the shared folders.

Just follow the port instructions to activate the whole lot.
 
Now that make it a good reason to install a FreeBSD guest on Windows. This somehow should work in reverse. A FreeBSD vm on a FreeBSD host. I’m tried of using USB. Thank you all!
 
You may have installed the package, but did you also configure its contents? Installing a kernel module doesn't imply that FreeBSD will also actually load it. Either do that manually using kldload or automatically by adding it to /boot/loader.conf.

Either way, I mixed up my ports. The important port to install here is emulators/virtualbox-ose-additions, these are the official guest additions. After that you'll also have /boot/modules/vboxvfs.ko at your disposal which should give you access to the shared folders.

Just follow the port instructions to activate the whole lot.

I have much to learn. :) I have never worked with the /boot/loader.conf before. Can you provide an example? I did check /boot/modules/vboxvfs.ko and I do have that. So, do I have to add that to the loader.conf? Please advise. Thanks.
 
Are you sure you need VirtualBox shared folders? Can you get away with transferring files using something a little bit more standard?

For VMs I personally run the SSH server on the FreeBSD guest and then then on the host, use an scp client (i.e WinSCP on Windows).

Just set up networking between the guest and host and enable sshd by adding the following to /etc/rc.conf

Code:
sshd_enable="YES"
 
Hi,

I am running FreeBSD-11.2 in VirtualBox in Windows10 since a few weeks.

Following cpm@ post line I got the thing working, but I would like to be
able to write into Windows directories as a regular-non-root user, is this possible ?

Till now, as a non-root user i can mount Windows directories for reading but i can
not write inside them.

bye
Nicola
 
Here's how you can do it:

* Install VBox Guest Additions:

. boot FreeBSD guest OS and log in as root

[FONT=Courier New] cd /usr/ports/emulators/virtualbox-ose-kmod && make install clean
cd /usr/ports/emulators/virtualbox-ose-additions && make install clean

poweroff[/FONT]

* Use shared folder from host server

. VirtualBox => Settings => Shared Folders => folder-add icon

. browse to the folder (let's presume the folder being selected is called "[FONT=Courier New]Shared[/FONT]"), select it then select "Auto-mount"

. boot FreeBSD guest OS and log in as root

[FONT=Courier New] mkdir /sf_[/FONT][FONT=Book Antiqua](name)[/FONT]
[FONT=Courier New]
vi /boot/loader.conf
vboxvfs_load="YES"

vi /etc/fstab
Shared /sf_[/FONT][FONT=Book Antiqua](name)[/FONT][FONT=Courier New] vboxvfs rw 0 0

reboot[/FONT]
 
Hello,

I have several FreeBSD guests on Windows VirtualBox.

The simplest to do to exchange files with Windows is to install samba (tested 46 and 47 versions) with pkg install .
Then, you have to create /usr/local/etc/smb4.conf with root user. The file should contain:
Code:
[global]
# workgroup = NT-Domain-Name or Workgroup-Name, eg: MIDEARTH
   workgroup = whatyouwant
   security = user
   map to guest = Bad User
  
[NameOfSharedSMB]
   path = /home/MyUser/Desktop/Shared
   read only = no
   public = yes

You have to replace "whatyouwant" by a workgroup name of your choice. And the same for "NameOfSharedSMB". I use a folder on the desktop of "MyUser" and you have to create this folder.

After that, type, while in root user:
sysrc samba_server_enable=YES
service samba_server start


Then, anyone can read and write in this folder.
 
Here's how you can do it:

* Install VBox Guest Additions:

. boot FreeBSD guest OS and log in as root

[FONT=Courier New] cd /usr/ports/emulators/virtualbox-ose-kmod && make install clean
cd /usr/ports/emulators/virtualbox-ose-additions && make install clean[/FONT]

[FONT=Courier New] poweroff[/FONT]

* Use shared folder from host server

. VirtualBox => Settings => Shared Folders => folder-add icon

. browse to the folder (let's presume the folder being selected is called "[FONT=Courier New]Shared[/FONT]"), select it then select "Auto-mount"

. boot FreeBSD guest OS and log in as root

[FONT=Courier New] mkdir /sf_[/FONT][FONT=Book Antiqua](name)[/FONT]

[FONT=Courier New] vi /boot/loader.conf
vboxvfs_load="YES"[/FONT]

[FONT=Courier New] vi /etc/fstab
Shared /sf_[/FONT][FONT=Book Antiqua](name)[/FONT][FONT=Courier New] vboxvfs rw 0 0[/FONT]

[FONT=Courier New] reboot[/FONT]

Thank you for detailed description, but still, my general non-root user can not create a flie in /mnt/windowsDir , he can only read. Problem remains.

[FONT=Courier New]bye
n.[/FONT]
 
Hello,

I have several FreeBSD guests on Windows VirtualBox.

The simplest to do to exchange files with Windows is to install samba (tested 46 and 47 versions) with pkg install .
Then, you have to create /usr/local/etc/smb4.conf with root user. The file should contain:
Code:
[global]
# workgroup = NT-Domain-Name or Workgroup-Name, eg: MIDEARTH
   workgroup = whatyouwant
   security = user
   map to guest = Bad User
 
[NameOfSharedSMB]
   path = /home/MyUser/Desktop/Shared
   read only = no
   public = yes

You have to replace "whatyouwant" by a workgroup name of your choice. And the same for "NameOfSharedSMB". I use a folder on the desktop of "MyUser" and you have to create this folder.

After that, type, while in root user:
sysrc samba_server_enable=YES
service samba_server start


Then, anyone can read and write in this folder.

Thank you Emiron, but i don't want to go in that direction. I was doing something similar over ssh in a Mac, before having this Windows machine. I prefer not to enable any network service on the Windows machine.
bye
n.
 
Thank you for detailed description, but still, my general non-root user can not create a flie in /mnt/windowsDir , he can only read. Problem remains.

[FONT=Courier New]bye
n.[/FONT]
Maybe you can try to give read+write access to a specific user or group, I've used this before:

$ sudo mount -t vboxvfs -o rw,gid=1001,uid=1001 vmshare $HOME/windowsDir

You can find your user's group-id (gid) and user-id (uid) by running:

$ id <user>

Regards,
 
Here's how you can do it:
Hi,

I have been running FreeBSD clients under VirtualBox on Windows 8.1 on my Samsung S9 notebook for about 6 years.

I chose VirtualBox because Windows can manage things like the backlit keyboard, and the battery usage in ways that BSD and Linux systems can not.

The shared folder facility didn't originally work with FreeBSD (the vbox file system driver was not available for FreeBSD), so I always used winscp as a work around.

I just got shared folders working with:
  • Server: Windows 8.1 with VirtualBox-5.2.26-128414-Win.exe
  • Client: FreeBSD 11.2-RELEASE and port VirtualBox-5.2.26.tar.bz2
Code:
[f112.98] # df -h
Filesystem      Size    Used   Avail Capacity  Mounted on
/dev/ada0s1a     31G     17G     12G    60%    /
devfs           1.0K    1.0K      0B   100%    /dev
tmpfs           2.7G    8.0K    2.7G     0%    /tmp
tmpfs           5.0M     88K    4.9M     2%    /var/log
C_DRIVE         214G    176G     38G    82%    /sf_C_DRIVE

Thank you for reminding me to keep up!

Cheers,
 
Maybe you can try to give read+write access to a specific user or group, I've used this before:

$ sudo mount -t vboxvfs -o rw,gid=1001,uid=1001 vmshare $HOME/windowsDir

You can find your user's group-id (gid) and user-id (uid) by running:

$ id <user>

Regards,

Thank you a LOT alcros , your method solves the issue for me, this was a long standing little pain !

I confirm it works in FreeBSD-11.2 running in VirtualBox-5.2.26 for Windows-10.

I add the fstab line, for other users who may need it in future.

EXAMPLE CASE.
I want to operate (read/write) on Windows "Downloads" directory from FreeBSD, using /mnt/win10,
and absolutely i want to do it from my regular user who has id 1001. So I add this
line in /etc/fstab:
--------------------------------
Downloads /mnt/win10 vboxvfs rw,gid=1001,uid=1001 0 0
---------------------------------

bye
n.
 
Thx, was helpful. (FreeBSD 13.1, Windows 10 21H2, VirtualBox 6.1.40)

Summary:

1) pkg ins virtualbox-ose-additions
ee /etc/rc.conf
vboxguest_enable="YES"
vboxservice_enable="YES"
ee /boot/loader.conf
vboxvfs_load="YES"

2) mount -t vboxvfs vbox_share_name /mnt
 
Yes, this was helpful. (FreeBSD 12.4 (Mate desktop), VirtualBox 7.0.8, Windows 11 Enterprise)

I took it a step further and added the following to /etc/fstab

vbox_share_name /mnt vboxvfs rw 0 0
 
Back
Top