Windows – Sharing folder from Windows Host to Freebsd Guest

freebsdvirtualboxwindows

What I am trying to accomplish:

  • I have (at home) a PC with Windows 7 installed
  • I would like to run a Unix in Virtual Box, because I am more used to developing / scripting on it

I settled on Freebsd at the moment, and I managed to install it and configure the network. The next step is sharing a folder from Windows to Freebsd so that I can easily edit files on Windows and on Freebsd both. Unfortunately it seems a though thing to do.

I rummaged on the net and found two different ways:

I installed the guest additions in freebsd using pkg_add -r virtualbox-ose-additions, the install proceeded switfly enough, and I edited /etc/rc.conf to add the two suggested lines: vboxguest_enable="YES" and vboxservice_enable="YES" and rebooted.

It did not work. The command to mount the system ends up in an error:

# mount -t vboxsf shared /home/myuser/shared
mount: shared : Operation not supported by device

where shared is the name of the folder I setup in my virtual box settings for this VM.

Is it actually possible to use a vboxsf filesystem type in freebsd ? Some comments seem to suggest it is not supported but finding up-to-date information is difficult.

Next, I moved on to the samba approach. I basically followed the guide I linked it. Unfortunately it ends up with:

# mount_smbfs -N -I 192.168.56.1 //winuser@winmachinename/Shared /mnt/shared
mount_smbfs: unable to open connection: syserr = RPC struct is bad

where Shared is the name of the shared folder I configured with windows, accessible to the winuser obviously. The ping works.

I would like to note that I have no password on the windows guest account I am trying to connect at, it seemed easier, but perhaps that it's bothering samba somehow.

edit: working from PuTTY I had not seen that some messages were printed in the console:

smb_maperror: Unmapped error 3:31
smb_co_lock: recursive lock for object 1

both appear several times. /end of edit

If the direct filesytem sharing does not work, any idea how to get samba to do it ? The article suggest it's already be done by some at least.

Technical information:

  • Host: Windows 7 Familial Edition (up-to-date)
  • Guest: FreeBSD 9.0-RELEASE #0: Tue Jan 3 07:15:25 UTC 2012 root@obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
  • Virtual Box: 4.1.16 r78094

I am open to new suggestions to sharing as well. I would if possible prefer avoiding transferring files back and forth: it's not particularly efficient and always a source of confusing errors.

I am also open to changing systems. I like the philosophy of freebsd, but if it does not work, I have no qualms about moving to a linux.

EDIT:

This question is now purely of theoretical interest. I switch to using Ubuntu Server and managed to set it up without samba since vboxsf is well supported.

Best Answer

VirtualBox shared folders are still not suppported on FreeBSD.

A FreeBSD ports committer has confirmed this on the FreeBSD mailing lists as of (2014-06-24):

Shared Folders for FreeBSD guests are not supported yet [...] There is some draft code and a kernel module for it but it's not working yet.

If you want to follow the state of the port, please search the mailing lists. There is also the #freebsd-vbox IRC channel on Freenode. It was posted to the freebsd-hackers mailing list at the bottom of this post. You will find developers there.

Finally, here is what the virtualbox-ose-additions port currently supports according to Chapter 22.2 of the FreeBSD Handbook as of today:

The VirtualBox™ guest additions provide support for:

  • Clipboard sharing.
  • Mouse pointer integration.
  • Host time synchronization.
  • Window scaling.
  • Seamless mode.

As you can see, no shared folders support yet for FreeBSD.

Chapter 4.3 of the VirtualBox manual states:

Shared Folders are supported with Windows (2000 or newer), Linux and Solaris guests.

Yet again no FreeBSD. Use SMB shares for now, following the instructions that others have mentioned.

Related Question