How to share directories b/n jails on 6.0?

Philip Hallstrom freebsd at philip.pjkh.com
Fri Feb 3 21:59:04 PST 2006


>>>>>> I've got a new 6.0 box and have setup some jails.  I'd like to share
>>>>>> /usr/ports from the host, to each of the jails.
>>>>>> 
>>>>>> I tried mount_unionfs and while it worked, the box would crash if I did
>>>>>> anything intensive (ie. compile a port).
>>>>>> 
>>>>>> Googling around and people say they are using nullfs okay, but the 
>>>>>> manpage
>>>>>> ends with:
>>>>>>
>>>>>>     THIS FILE SYSTEM TYPE IS NOT YET FULLY SUPPORTED (READ: IT DOESN'T
>>>>>>     WORK)
>>>>>>     AND USING IT MAY, IN FACT, DESTROY DATA ON YOUR SYSTEM.  USE AT 
>>>>>> YOUR
>>>>>>     OWN
>>>>>>     RISK.  BEWARE OF DOG.  SLIPPERY WHEN WET.
>>>>> 
>>>>> 
>>>>> nullfs is fine in 6.0, and the warning has been removed.
>>>> 
>>>> 
>>>> Good to know it's cool.  I'll start playing with it.  The warning is 
>>>> still
>>>> there though... in both 6-stable and 7-current.
>>>> 
>>>> http://www.freebsd.org/cgi/man.cgi?query=mount_nullfs&apropos=0&sektion=0&manpath=FreeBSD+6.0-stable&format=html 
>>>> http://www.freebsd.org/cgi/man.cgi?query=mount_nullfs&apropos=0&sektion=0&manpath=FreeBSD+7.0-current&format=html 
>>> 
>>> 
>>> Those manpages are out of date.
>>> 
>>> http://www.freebsd.org/cgi/cvsweb.cgi/src/sbin/mount_nullfs/mount_nullfs.8 
>> 
>> 
>> Sweet!
>>
>>     MFC: Remove big scary warning about nullfs state
>> 
>> :-)
>> 
>> I've set it up already and it works great.

On Fri, 3 Feb 2006, Tim Traver wrote:

> How did you set it up specifically ?
>
> and is it just fixed in 6.0 ? or does it also work in 5.4 ?

No idea about 5.4...

For 6...

/etc/rc.conf:

 	jail_sandbox_rootdir="/local/jails/sandbox/"
 	jail_sandbox_hostname="sandbox.pjkh.com"
 	jail_sandbox_ip="123.123.123.123"
 	jail_sandbox_exec="/bin/sh /etc/rc"
 	jail_sandbox_devfs_enable="YES"
 	jail_sandbox_mount_enable="YES"

/etc/fstab.sandbox:

 	/usr/ports /local/jails/sandbox/usr/ports nullfs rw 0 0


Then once started with /etc/rc.d/jail start sandbox I have this:

% df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
....
devfs          1.0K    1.0K      0B   100%    /local/jails/sandbox/dev
/usr/ports     3.9G    1.9G    1.7G    52% 	  /local/jails/sandbox/usr/ports

I also came across this afterward... which I might give a go...

http://www.freebsd.org/cgi/url.cgi?ports/sysutils/ezjail/pkg-descr

Looks like it null mounts a lot more (ie /bin /sbin, /usr/lib, etc.)

-philip


More information about the freebsd-questions mailing list