DEVFS in a chroot?

Wes Peters wes at
Fri Apr 30 08:52:09 PDT 2004

On Friday 30 April 2004 07:02, Poul-Henning Kamp wrote:
> In message <20040430.075448.70646001.imp at>, "M. Warner Losh" 
> >In message: <6695.1083331489 at>
> >
> >            "Poul-Henning Kamp" <phk at> writes:
> >: In message <20040430.070341.26991317.imp at>, "M. Warner Losh" 
> >: >In message: <5473.1083327210 at>
> >: >
> >: >            "Poul-Henning Kamp" <phk at> writes:
> >: >: >Should I mount /var/chroot/dev as type devfs?
> >: >:
> >: >: Yes:
> >: >:
> >: >: 	mount -t devfs randomargument	/var/chroot/dev
> >: >
> >: >What if I have hundreds of these chroots?  We build our product
> >: > inside a chroot right now and I'm worried what the overhead of
> >: >mounting/unmounting this for every build would be...
> >:
> >: As far as I recall, our mountlist handling is not optimised for
> >: hundreds of simultaneous mountpoints: we basically walk the list.
> >: That said, I belive we only do so during the actual mount/unmount
> >: operations, so I do not think there is a performance issue as such.
> >
> >Would the performance issues be mitigated by mounting/unmounting devfs
> >all the time?  Eg, only mount it while it is actively being used?
> I think you would actually make it worse that way...

We do this on our build box -- mount and unmount both devfs and a read-only 
source directory, chroot, and build, as in:

/usr/wes/products on /usr/obj/buildenvs/usr/wes/products/iamsrc (nullfs, 
local, read-only)
devfs on /usr/obj/buildenvs/usr/wes/products/dev (devfs, local)

And then unmount once the build has completed.  We have 'chroot' and 
'unmount' targets in the top-level makefile to get back into and out of the 
chroot as well.

On 5.2.1, our build box hangs once or twice a week on an unmount.  I'm not 
sure if it's the nullfs or the devfs unmount.  I haven't had time to debug 
this, I've been ankle deep (head first) in PHP and Perl code that are the 
guts of my product for 6 weeks now, but I'll try to catch it in the 
debugger next week once the smoke clears.

I run -CURRENT on my workstation and it has not hung in a while, but it 
doesn't get pounded the way the buildbox does.  Is there some resource 
related to mounts that might be getting leaked?


        Where am I, and what am I doing in this handbasket?

Wes Peters                                               wes at

More information about the freebsd-current mailing list