mount_unionfs for jails

David Polak me at
Thu Sep 25 22:04:04 UTC 2008

> -----Original Message-----
> From: owner-freebsd-questions at [mailto:owner-freebsd-
> questions at] On Behalf Of Nejc S(koberne
> Sent: Thursday, September 25, 2008 3:33 PM
> To: David Polak
> Cc: freebsd-questions at
> Subject: Re: mount_unionfs for jails
> Hello,
> > Here is what I am trying to do:
> >
> > mount_unionfs -o below /usr/jails/basejail /usr/jail/jail1
> >
> > after I do that I edit /usr/jail/jail1/etc/rc.conf and add the
> appropriate
> > entries to the host system rc.conf, but when I start the jail it
> starts
> > using the settings from /usr/jails/basejail.
> I have the same setup and it works for me.
> > Is my mount_unionfs syntax wrong, is this a bug in unionfs (man page
> says
> > unionfs is broken, but doesn't specify how its broken) or is this
> expected
> > behavior?
> It shouldn't be wrong. I have this in my fstab:
> /jail/base   /jail/spl/nejcspl       unionfs rw,noatime,below     0
> 0
> (noatime option is completely optional, of course.)
> But, if I were you, I would update the RELEASE to STABLE. This will
> also fix
> some bugs in unionfs. However at least some other bugs still aren't
> fixed in 7-STABLE
> to this day (most notably the socket bug, which prevents mysql from
> running in a jail
> and writing socket file to /tmp/mysql.sock), so we had to MFC the patch
> from
> HEAD manually. If you need the patch, let me know.
> However, I don't suggest running jails on top of unionfs where you need
> decent stability (i.e. in production). I am writing thesis at the
> moment which
> also covers this topic. We also stumbled upon these issues:


> So, you can see that there are (still) many issues with unionfs on
> FreeBSD.
> Please let me know if you are able to solve your problem. Or else we
> can make
> this list a little longer. :)
> HTH,
> Nejc
> _______________________________________________
> freebsd-questions at mailing list
> To unsubscribe, send any mail to "freebsd-questions-
> unsubscribe at"

Well, it turns out that my problem was due to a typo in my host systems

I had duplicated the jail block and used a regex to rename it to the unionfs
jail, but missed the directory...

Right now, I am just testing things, but if it works, I'l use it. It seems a
lot more elegant that other solutions, as long as it actually works. 

Do you know if there is a way to "reset" the unionfs? I did notice this:

fsserver# mkdir dir1 dir2
fsserver# touch dir1/basefile.file
fsserver# mount_unionfs -o below dir1 dir2
fsserver# ls dir2/
fsserver# rm dir2/basefile.file
fsserver# ls dir2
fsserver# umount dir2
fsserver# ls dir1 dir2

fsserver# mount_unionfs -o below dir1 dir2
fsserver# ls dir1 dir2


seems useful, but where does it store that info in case you need to make
stuff show up again?

More information about the freebsd-questions mailing list