SOLVED Which snapshot will restore a complete Pool?

NumberSix

Contributor
Joined
Apr 9, 2021
Messages
188
Hi
My setup is very simple. I have just 2 pools; boot, system and NAS I call them. The first two are self explanatory, the third holds everything I own a NAS for - all my data. I have regular snapshots of each, every 3 weeks I think, which I keep for just two generations. I have noticed already that this process generates hundreds of snapshots, with names like:
  • System/
  • System/iocage/download
  • System/iocage/download/12.1-RELEASE
  • System/iocage/jails/grafana/root
... to name but four, chosen at random.

Cometh the day that my System pool (for example) dies (it maps to an SSD drive), and I buy a replacement and switch the new one over, I wonder how to proceed?
1. would the system boot at all?
2. If so, would it prompt me what to do?
3. Assuming I lurch towards a position where the system is sort of up, how do I pick which snapshot to restore (the primary one I imagine - 'System/'?) and will selecting that single snapshot restore everything 'underneath' System too - the full monty*?

The dreaded crash hasn't happened yet, but as it's inevitable eventually, I thought it wise to ask questions now so I can better prepare for how to fix it when it does put in it's unwelcome appearence.

Thank you for your thoughts!!

* Cultural note. Through my friends in the US, I have learnt that, thanks to the English film "The Full Monty", most Americans have come away with the firm impression that the phrase is some sort of euphamism for being naked. This is totally and completely inaccurate. The idiom means to 'go the whole hog', to mix my metaphors. If you were in a restaurant, for example, you might order the full monty - meaning everything on the menu. Or if you were a stripper and went the full monty, you'd take off everything. My use of the phrase here is the accurate one (I'm English!), so I mean 'a full restore of everything that was on the System drive'! Cheers.
 

Heracles

Wizard
Joined
Feb 2, 2018
Messages
1,401
Cometh the day that my System pool (for example) dies (it maps to an SSD drive), and I buy a replacement and switch the new one over, I wonder how to proceed?

The best way to get out of this scenario is not snapshots. Instead of taking snapshots of your boot pool, you should backup your config. Keep that backup safe and should you need it, install a fresh and new TrueNAS before restoring that config to it.

Know that by definition, a snapshot resides inside the very same storage as its original. Its is kind of pointers and not an actual copy of the data.

For that very reason, do not consider your other snapshots as backups either. The day your pool will die for any reasons, all snapshots will die with it.

For a complete backup strategy, you can review my signature,
 

NumberSix

Contributor
Joined
Apr 9, 2021
Messages
188
Instead of taking snapshots of your boot pool, you should backup your config.
Hi Heracles!
Thank you for your thoughts. Your answer focuses on the boot pool. My example covered all pools, but specifically the system pool. Do these other pools (System and 'NAS" in my case) each have their own configs that can be saved too?

Thank you.
 

NumberSix

Contributor
Joined
Apr 9, 2021
Messages
188
No reply - I'm assuming then that the answer is 'no' - only one config for the entire setup.
 

NugentS

MVP
Joined
Apr 16, 2020
Messages
2,947

Arwen

MVP
Joined
May 17, 2014
Messages
3,611
No, data pools do not have configs.

To backup a data pool, use the most currently created snapshot. Or create one just before your backup.
 

NumberSix

Contributor
Joined
Apr 9, 2021
Messages
188
I just noticed this page of documentation:
https://www.truenas.com/docs/core/storage/pools/storageencryption/#encrypting-a-new-dataset
It concerns saving a 'keyfile' when you encrypt a data pool. Having done just that, and wanting that pool to be protected come a total drive failure, I'm unsure if the snapshots mentioned will be sufficient. Looking at this part of the above page...
screenshot.1.jpg

I realise that I did not 'DOWNLOAD ENCRYPTION KEY' when the pool was created. No matter apparently, since the documentation says I can do so now. Hmm. Unfortunately, the current GUI does NOT have the menu option indicated here. There is NO "Export Dataset Keys" anywhere that I can find. Has this option moved? Is there a new way of getting a set of keys for safe keeping? Do they form part of a snapshot instead now? All insights gratefully accepted!
 

Arwen

MVP
Joined
May 17, 2014
Messages
3,611
No, ZFS snapshots do not include the encryption keys. I don't know how to download the encryption keys. But, it should be possible and you WANT to do it, (in addition to saving your NAS' configuration).

Think of ZFS snapshots as a R/O, (Read Only), copy of your dataset(s), (or entire pool, if you make a recursive snap from the top level). Anything added after won't be in that snapshot. This allows restoring file(s), a whole dataset, or entire pool, to the point in time of any snapshot.

Their is a script out their that will save your NAS' configuration to a data pool. I use it, seems to work fine. However, if you save it to an encrypted data pool, it's less useful, because the encryption then protects, (or prevents), access to the configuration.


One last advice about ZFS snapshots. Manage them. Meaning don't create endless snapshots and assume everything is good. As you delete old files, they would still exist in snapshots made after the file was added, but before the file was deleted. This is good, until you run out of space because you tons of old snapshots.
 

NumberSix

Contributor
Joined
Apr 9, 2021
Messages
188
Thank you Arwen. Very useful advice. Tell me, short of finding (and correctly configuring) a script to handle these tasks for me, how would I go about finding the current snapshots for pool A, automatically stored somewhere on A, and moving them all to pool B and into a chosen folder, manually?

I guess if I wanted the system to write them that way in the first place, then I'd have to truffle out that script you mentioned?! :)

Thank you again.
PS my quest for how on earth to download encryption keys continues. I have a suspect though. If you go to the GUI and to System / General, there's a "Save Config" button at the bottom. The dialogue includes a checkbox "Include secret seed". Is that what was eelsewhere refered to as "enryption keys"? Is that it?!!
 
Last edited:

Arwen

MVP
Joined
May 17, 2014
Messages
3,611
TrueNAS has GUI options for ZFS replication using ZFS snapshots. I don't use it because I only have 1 NAS & 1 pool on that NAS.

The script I mentioned stores your NAS configuration locally only. Has nothing to do with ZFS snapshots.

Sorry, I don't know if "include secret seed" is what you need. My encryption is not through the NAS.
 

NumberSix

Contributor
Joined
Apr 9, 2021
Messages
188
Thank you Arwen.
Your insights and thoughts on this are very much appreciated!

On the question of how to export encryption keys, I decided to open it as it's own thread, in the hope that more people might engage with it. Fingers crossed!!
 

NugentS

MVP
Joined
Apr 16, 2020
Messages
2,947
Thank you Arwen. Very useful advice. Tell me, short of finding (and correctly configuring) a script to handle these tasks for me, how would I go about finding the current snapshots for pool A, automatically stored somewhere on A, and moving them all to pool B and into a chosen folder, manually?

I guess if I wanted the system to write them that way in the first place, then I'd have to truffle out that script you mentioned?! :)
Just use Tasks/Replication to copy snapshots to alternative media. This (together with the snapshot task that it generates) will manage the snapshots for you - keeping them for a period of time and then deleting them
 

NumberSix

Contributor
Joined
Apr 9, 2021
Messages
188
Ahh! Thank you NugentS.
Memo to self: keep it simple, stupid!
I am doing that as I write. Most obliged. Thank you.
 

NumberSix

Contributor
Joined
Apr 9, 2021
Messages
188
Just use Tasks/Replication to copy snapshots to alternative media. This (together with the snapshot task that it generates) will manage the snapshots for you - keeping them for a period of time and then deleting them
Just to clarify - 'Task/Replication' is actually taking Snapshots? It is the Snapshots that are taken at 'source' and saved at 'destination', not any other sort of data?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
1. Yes. 2. The snapshots are all the data in the dataset/zvol in question.
 

NumberSix

Contributor
Joined
Apr 9, 2021
Messages
188
Top