Use NFS to create a VirtualBox “shared folder” for a FreeBSD 8.0 Guest

Whilst tinkering with NFS, I found a neat application for the lack of shared folders support for my FreeBSD 8.0 VirtualBox guest running in an OpenSolaris host. Although there is a FreeBSD port of VirtualBox Guest Additions, it doesn’t seem to do too much else other than enable seamless host/guest mouse integration.

This is an insecure configuration, and I certainly would not recommend running it on anything other than a private configuration. All the same, this works quite well for me, so may be of use for someone else.

I’m using an OpenSolaris snv_134 x64 host, running VirtualBox 3.1.6 with a FreeBSD 8.0 x86 guest machine installed configured according to The name of my host serving up NFS exports is afterburner.


Let’s configure the OpenSolaris host for NFS. First, create an NFS share point named “testshare” at /export:

$ pfexec mkdir /export/testshare
$ pfexec chmod 777 /export/testshare


Create an NFS share group named “testgroup”, and verify the operation:

$ pfexec sharemgr create testgroup

$ sharemgr list -v                
default	enabled	nfs
zfs	enabled	
testgroup	enabled	nfs


Add the share /export/testshare to the share group “testgroup”, and verify the operation:

$ pfexec sharemgr add-share -s /export/testshare -d "this is a test NFS share" testgroup

$ sharemgr show -v                                                                      
	  /export/testshare	"this is a test NFS share"

$ share
-@testgroup     /export/testshare   rw   "this is a test NFS share"


Now, configure FreeBSD to automagically mount the NFS share when accessed, using amd (no, not that one). This is a modification of the very helpful guide here, and I agree with that author’s assertion that documentation for those new to amd is somewhat lacking.


So, enable amd in FreeBSD by adding amd_enable=”YES” and amd_flags=”” to /etc/rc.conf. My /etc/rc.conf file (in total) reads:

# -- sysinstall generated deltas -- # Sun Mar 28 04:08:02 2010
# Created: Sun Mar 28 04:08:02 2010
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
local_startup="${local_startup} /usr/local/kde4/etc/rc.d"


Create the file /etc/amd.conf containing the following:

auto_dir        = /.amd
log_file        = /var/log/amd.log
log_options     = error,fatal,warning
map_type        = file
search_path     = /etc

map_name        = amd.nfs


Create the file /etc/amd.nfs containing the following (this should be all on one line, but for blog formatting sake I have added a line break directly after the first equals sign, and there should be no space between it and the following double quotation mark):

testshare  fs:=${autodir}${path};type:=program;mount:=
"/sbin/mount mount -t nfs -o rw,-N afterburner:/export/testshare ${fs}";

(Note that afterburner is the name of my host system serving up the NFS export, and I’ve added this to my FreeBSD guest’s hosts file at /etc/hosts. You would of course modify this to suit your own setup.)


Finally, start the amd daemon:

# /etc/rc.d/amd start


Now, in the FreeBSD guest open up a terminal and cd to /nfs/testshare. amd should mount the location as an NFS share automagically, and you can now exchange files between the VirtualBox host and guest environments.

For ease-of-use I’ve created a symlink on the respective desktops of my host and guest OSs:

NFS shared folder between OpenSolaris and FreeBSD


1 thought on “Use NFS to create a VirtualBox “shared folder” for a FreeBSD 8.0 Guest

  1. Pingback: 2010 in review « Dave Koelmeyer

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s