How do I Protect Jails/VMs during upgrade?

NASbox

Guru
Joined
May 8, 2012
Messages
650
I am still running TrueNAS 12-U8.1, and I haven't had the time (or for that matter an urgent need to upgrade), but now I want to upgrade so I don't get too far behind which might cause future upgrading problems.

What directories do I need to snapshot so that I have an easy way to roll back in the event that something gets corrupted when I start the jails after the upgrade.

I also have 3 zvols in POOL/VMSTORAGE for 3 VMs.

If I create a RECURSIVE, manual snapshots of POOL/iocage and POOL/VMSTORAGE, will that do what I need?
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
What directories do I need to snapshot so that I have an easy way to roll back in the event that something gets corrupted when I start the jails after the upgrade.
What would make you think that this would happen? A recursive snapshot of the jail(s) dataset in question would do what you are asking.
 
Joined
Oct 22, 2019
Messages
3,641
You can also utilize the "checkpoint" feature for something like this.

This is done at the pool level, and can be discarded later when you see no reason to revert back to the checkpoint.

(In fact, a "checkpoint" should only be used as a short-term safety net for pre-upgrades or pre-major operations. Remove the checkpoint shortly after a successful post-operation.)
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
What would make you think that this would happen? A recursive snapshot of the jail(s) dataset in question would do what you are asking.
@Jailer Thanks for the reply - I don't know very much about FreeBSD jails, and what happens with an upgrade.

I just upgraded from 12-U8.1 to 13-U5.3, which IIUC means an upgrade to the underlying FreeBSD version. When the jail starts up, could that change of underlying OS cause a problem?
You can also utilize the "checkpoint" feature for something like this.

This is done at the pool level, and can be discarded later when you see no reason to revert back to the checkpoint.

(In fact, a "checkpoint" should only be used as a short-term safety net for pre-upgrades or pre-major operations. Remove the checkpoint shortly after a successful post-operation.)
@winnielinnie I forgot about checkpoints, vaguely remember reading about them years ago. How do you create a checkpoint from the GUI?

Do you think a checkpoint is the best way? IIUC the recursive snapshots would give me more flexibility when it comes to rolling back changes would it not? I have 3 jails, and if only one went bad, then I could rollback only that one jail couldn't I?
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
I just upgraded from 12-U8.1 to 13-U5.3, which IIUC means an upgrade to the underlying FreeBSD version. When the jail starts up, could that change of underlying OS cause a problem?
I think you're mis understanding how uprgrades to TrueNAS work. The data on your pool is untouched during an upgrade. This includes your jails as they reside in a dataset on your pool. Your boot drive, where the OS lives is what gets upgraded. When you upgrade a new snapshot is created and labeled "Now/Reboot" in the GUI. If for some reason the upgrade fails or is somehow not working properly you can roll back to a previous boot environment and restore it to it's previous state. This is all covered in the manual linked at the top of the forum page under the "Documentation" heading.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
If a new version of iocage is part of a TrueNAS upgrade, that might change/update your jail configuration (config.json) and if you subsequently roll back your TN version for whatever reason, jails might fail to start because the older iocage version does not recognise new keywords. This situation can easily be fixed by manually editing the config.json files of the jails. IIRC iocage also creates a backup copy.

The data that comprises your jail is left untouched so a manual snapshot is not strictly necessary. But if it helps you sleep better, it definitely doesn't hurt, so go ahead. A recursive snapshot of the <pool>/iocage/jails dataset will do the trick.
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
Thanks @Jailer & @Patrick M. Hausen - I really appreciate the assistance, as I certainly have a lot to learn.

I think you're mis understanding how uprgrades to TrueNAS work. The data on your pool is untouched during an upgrade. This includes your jails as they reside in a dataset on your pool. Your boot drive, where the OS lives is what gets upgraded. When you upgrade a new snapshot is created and labeled "Now/Reboot" in the GUI. If for some reason the upgrade fails or is somehow not working properly you can roll back to a previous boot environment and restore it to it's previous state. This is all covered in the manual linked at the top of the forum page under the "Documentation" heading.
That agrees with my understanding, the issue is what happens AFTER the update. The software upgrade may go perfectly (from the perspective of someone just setting up brand new jails/plugins/VMs), but the jails/plugins/VMs from past version may have problems.
If a new version of iocage is part of a TrueNAS upgrade, that might change/update your jail configuration (config.json) and if you subsequently roll back your TN version for whatever reason, jails might fail to start because the older iocage version does not recognise new keywords. This situation can easily be fixed by manually editing the config.json files of the jails. IIRC iocage also creates a backup copy.

The data that comprises your jail is left untouched so a manual snapshot is not strictly necessary. But if it helps you sleep better, it definitely doesn't hurt, so go ahead. A recursive snapshot of the <pool>/iocage/jails dataset will do the trick.
@Patrick M. Hausen Tanks for the info on the (config.json) file - that is news to me, and I'll make a note. I t

Here is what I am still having trouble with/have knowledge gaps with:
  1. After the upgrade, I'm concerned that a jail may not start, or worse -- start, let the application partially start, and then corrupt the application's data files.
  2. This is the next step beyond the question I asked, but after I update TrueNAS, then there is the issue of updating the jail (the only one that I am really concerned about is a syncthing plugin at the moment - the other jails are "throw away"). If things go bad, then I need a really quick way to get back to where I was.
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
That agrees with my understanding, the issue is what happens AFTER the update. The software upgrade may go perfectly (from the perspective of someone just setting up brand new jails/plugins/VMs), but the jails/plugins/VMs from past version may have problems.
Then figure out what the problem is and roll back to a previous boot environment and fix it.
 
Top