Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

How to create your own jail template based on an existing jail


FreeNAS Experienced
Aug 15, 2013
Since googling & searching the guides and this forum did not deliver, here's the way I created my own template in Freenas 9.3.
I needed a jail template with an updated ports tree, an apache24 and a mysql-server set up, to use as a base for other jails. You might think this to be crazy, but I like to split up stuff in different jails as much as possible.

I assume that /path/to/http-server/ is a location reachable via http.
for me this is in another jail, with a webserver, something like: /mnt/myzfsvolume/jails/web/var/www/jail-templates.
I can reach the jail-templates folder via http using http://web/jail-templates.

1. Create a jail (I called it puppet)
2. Install, upgrade and/or do various stuff in the jail as a base. For example, I set up the ssh-server and setup the rsa-key authentication in order to ssh from my main workstation without having to authenticate. I installed portmaster, apache24 and mysql-server56.
3. Shut down the jail.
4. Directly on the freenas which hosts the jail do the following
mtree -c -p /path/to/jails/puppet -k sha256digest > puppet-template.mtree
mv puppet-template.mtree /path/to/http-server/jail-templates/
cd /path/to/jails/puppet
tar -czf /path/to/http-server/jail-templates/puppet-template.tgz .
warden template create -tar /path/to/http-server/jail-templates/puppet-template.tgz -nick puppet-template
(You could probably do the mtree destination directly to the jail-templates folder on the http)

In the Freenas gui now create a new 64bit jail template, which points to
... and you're done.

Once you create jails based on this template, mind that you would need to set a new hostname in /etc/rc.conf.
Also the passwords will be taken over from the template. Keep your eye on security.

You can still find the old templates here:
You could probably add them, using the warden.
Last edited: