Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In FreeBSD, how do I automate the process of mounting of a directory into a jail at boot time?

share|improve this question

migrated from stackoverflow.com Mar 10 '11 at 17:53

This question came from our site for professional and enthusiast programmers.

add comment

2 Answers 2

How about using nullfs mounts? It's similar to bind-mounts on Linux. I.e. mount another location onto a folder.

share|improve this answer
    
I finally got it working by using the cron utility. Thanks for all of your suggestions. Cheers. –  user71126 Apr 8 '11 at 4:37
add comment

Reading through /etc/default/rc.conf there are some nice entries for setting up jails. Most notable is:

#jail_example_exec_afterstart0="/bin/sh command"        # command to execute after the one for
                                                        # starting the jail. More than one can be
                                                        # specified using a trailing number

So you could use that to execute a script within the jail to mount a directory (as long as that directory is available from within the jail, such as NFS mounts etc).

Alternatively you would just ensure that the mounts are all done before the jail starts by using nullfs in /etc/fstab:

/path/to/source /path/to/jail/directory nullfs ro 0 0

Replace the ro with rw if you want to allow writing to that directory.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.