Mount Previously Jailed ZFS Dataset on TrueNAS

FreeBSD jails are a fantastic feature, and they’re also available on TrueNAS as TrueNAS is based on FreeBSD. I use TrueNAS jails for various purposes, which are outside the scope of this article, and it’s often very useful to give said jails exclusive access to a ZFS dataset. This is accomplished by ticking the jail_zfs box under the jail’s Custom Settings section, and also setting the dataset to give access to in jail_zfs_dataset and its mountpoint (inside the jail) in jail_zfs_mountpoint.

This works great, the jail has exclusive control over the dataset and the host doesn’t need to get involved. But what if one day the need arises to mount the dataset on the TrueNAS host itself, for example if the jail gets corrupted? I always like to know that I have access to raw data should an event like this happen, so I decided to investigate how to mount the dataset on the TrueNAS host.

Firstly, we need to stop the jail. Once this is done, we can dive into the TrueNAS Shell. Run the following commands:

To start with, disable the jailed parameter on the dataset in the pool. Replace pool and dataset as required.

zfs set jailed=off pool/dataset

Next, set the mountpoint parameter of the dataset.

zfs set mountpoint=pool/dataset pool/dataset

Finally, mount all datasets using the following command: this will pick up the new mountpoint of the dataset in question and mount it, other datasets already mounted will not be affected.

zfs mount -a

Now, the dataset will be mounted at the mount point specified. It’s now possible to access the volume from the TrueNAS host.

I hope this has been helpful.

Tim