# Unable to mount nullfs for Jails on ZFS



## volatilevoid (Jan 21, 2010)

Hi,

I just tried to set up the jails on the machine running the ZRAID1. Unfortunately, I can't mount the required directories for them. When trying to boot with the mountpoints inserted in /etc/fstab, booting fails with an error message complaining that /usr/home is not existing.

I'm pretty sure this has something to do with ZFS and its way mounting directories as there were no problems when trying the same thing on UFS.

Any hint on this? Mounting works if I use a fstab without the mountpoints for booting and exchanging it with one containing the additional entries afterwards - but that's not very convenient.


----------



## Savagedlight (Jan 21, 2010)

You could create a rc script which mounts the points manually using the following command: `# mount -t nullfs /path/to/source/dir /path/to/jailed/dir`

Should be easier than swapping the fstab etc, at least.


----------



## volatilevoid (Jan 21, 2010)

Thanks, I'll definitely giving your suggestion a try.

I hope /usr/home is available when executing the script.


----------



## Savagedlight (Jan 21, 2010)

Actually, a much better solution to your problem can be found [post=19150]here[/post].


----------



## volatilevoid (Jan 21, 2010)

Thanks, that's a good direction, but unfortunately, mount doesn't want to use my additional fstabs. I already checked /etc/defaults/rc.conf and it seems that 
	
	



```
jail_<jailname>_fstab
```
 is now not a YES/NO option anymore. So I set 
	
	



```
jail_<jailname>_fstab="/etc/fstab.<jailname>"
```
 and rebooted. Then I'd get the message that /dev isn't existing in the jail - as the directories were not mounted. There is an additional option in /etc/defaults/rc.conf, namely 
	
	



```
jail_<jailname>_mount_enable
```
 which I set to YES. Still no luck, though...


----------



## SirDice (Jan 21, 2010)

Here's how I set up mine:

```
jail_enable="YES"
jail_list="internetz"
jail_internetz_rootdir="/jail/j1/"
jail_internetz_hostname="internetz.dicelan.home"
jail_internetz_ip="192.168.1.191"
jail_internetz_interface="re0"
jail_internetz_mount_enable="YES"
jail_internetz_devfs_enable="YES"
jail_internetz_devfs_rules="jail"
jail_build_rootdir="/jail/j2"
jail_build_hostname="build.dicelan.home"
jail_build_ip="192.168.1.192"
jail_build_interface="re0"
jail_build_mount_enable="YES"
jail_build_devfs_enable="YES"
jail_build_devfs_rules="jail"
```

Starting the build jail automatically mounts filesystems as defined in my /etc/fstab.build:

```
/tmp/build      /jail/j2/tmp/build      nullfs  rw      0       0
/usr/ports      /jail/j2/usr/ports      nullfs  rw      0       0
/storage/FreeBSD/distfiles      /jail/j2/usr/ports/distfiles    nullfs  rw      0       0
/usr/src        /jail/j2/usr/src        nullfs  rw      0       0
/usr/obj        /jail/j2/usr/obj        nullfs  rw      0       0
```

Works perfectly.


----------



## volatilevoid (Jan 21, 2010)

Thank you! After fiddling around with my fstabs and not trying to mount from a symlink :r and your additions I finally got it working.

Thanks again, Savagedlight and SirDice!


----------

