Updating Jails

Written by Michael Cole - July 22nd 2015

As you most likely know FreeBSD 10.1-RELEASE-p15 came out. So this was cause for updating my host OS, and also my jails. If you missed my previous post on jails, you may want to check that out. If not, you at least need to know that I am using iocage for my jail management. Currently I have 4 jails and 1 template. So I need to update all of these. With iocage this was pretty simple. You run:

iocage update *jail name*

This does several things for you. Since iocage uses ZFS very heavily, the first thing it does is to take a snapshot of the jails dataset. Then it downloads updates and applies them with freebsd-update. IT will tell you it is complete and to remove the snapshot when you are finished testing your jail.

Now you can do whatever testing you deem necessary. My jails are all currently name servers in progress. Some are nsd and some are unbound. So I ran a few queries against DNS. These seemed ok. Now I can type:

iocage snaplist *jail name*

This not only lists snapshots that iocage made, but manual snapshots and shapshots created by other tools for the jail data set. The snapshots made by iocage start with ioc. For example:

ioc-update_2015-07-22_16:27:19        Wed Jul 22 16:27 2015  192K    0

So now you have a few choices, you can rollback/undo the changes with:

iocage rollback *jail name*@*snapshot name*

Or if you believe everything went well you can remove the snapshot with:

iocage snapremove *jail name*@*snapshot name*

Of course you can keep it as long as you like. Since I have some automated snapshots being preformed and I'm fairly certain my jails are working anyways. I will remove it. With iocage, you can also use zfs commands directly. And don't forget all of these commands work on your templates too. So the next jail you create will also be updated.

Don't forget to do the freebsd-update on your host too. Remember jails run of the host kernel. Also reboot if needed (kernel updated).