In this brief tutorial I will cover a quick and simple method for mounting folders on your FreeBSD host machine to a jail. I am writing this because I remember having the need to do this for the first time and my google-foo returned a variety of posts with complex and overkill methods.
I wanted to mount my host’s /var/music folder within a jail to setup Subsonic. In the host machines /etc folder exists a fstab file for each jail runing on the system.
# cd /etc/ # ls fstab.timstunz_noip_me fstab.debarbora_com fstab.subsonic_org
So to mount /var/music to my subsonic jail
# nano /etc/fstab.subsonic_org
add this to mount the directory as read-write
/var/music /usr/jails/subsonic.org/var/music nullfs rw 1 1
or for read-only
/var/music /usr/jails/subsonic.org/var/music nullfs ro 0 0
That’s it now the host folder /var/music will be mounted to the jail at startup!