Backup and restore TrueNAS configuration

dwchan69

Contributor
Joined
Nov 20, 2013
Messages
141
Is there a way to do a backup and restore for the entire TrueNAS Core server? Use case, if you need to wipe and drop the server
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080

dwchan69

Contributor
Joined
Nov 20, 2013
Messages
141
sorry for the confusion, I am looking if there is a way to backup the settings on the TrueNAS system in case of a TrueNAS OS failure (e.g. the OS SSD die). As I am wrapping up getting my systetm up and running, flashing all the firmware, and planning out the disk layout, I am looking into backing up of data (e.g. to another pool and to S3) and other potential pitfalls, like TrueNAS core OS will not boot. Given I am still green to TrueNAS/FreeNAS, just trying to do some proactive planning and understanding the cause and effect to

1. OS drive die or I did something really really bad to the OS configuration
2. If I do end up reinstall TrueNAS, and I do not touch the drive configuration, how TrueNAS detect and know what the disk configuration (e.g. Pool/vdev/dataset, etc).
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
1. OS drive die or I did something really really bad to the OS configuration
The backup of the configuration db that I pointed you to is the thing to understand. There may be a few things that are missed by the system config, but primary storage and network configuration is stored for sure. I have had a boot drive failure a couple different times over the years. It is a fairly simple matter to do a fresh install on new boot media, then restore the configuration db. It will bring the system back to the configuration as of the date of the configuration backup. The only thing I have had that didn't come back after was jails that I had configured.
2. If I do end up reinstall TrueNAS, and I do not touch the drive configuration, how TrueNAS detect and know what the disk configuration (e.g. Pool/vdev/dataset, etc).
When you do a new install and it boots, it will not import the pool because the pool is seen as foreign. Once the configuration is loaded from backup, the system will reboot, it will then recognize and import the pool. I have found it clean and easy to bring the system back from a configuration backup.
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
PS. Depending on what you plan to use your system for, it might be better to use FreeNAS 11.3 for now. There are still some bugs in the TrueNAS 12.0-U1 release.
 

dwchan69

Contributor
Joined
Nov 20, 2013
Messages
141
My system will be use for home data, lab data , plex and iSCSi VM. Minus the iSCSI VM, all will be backup in various different ways until I understand the system better. Thank you for the link you provide, I will take a closer look as to the pool / vdev design and layout, as this is one area where I know the parts I need, but still on the fence as to which configuration is best to go with. For example, minus the external JBOD I have (Dell MD1200), it can handle up to 16-18 3.5 HDD, and optional for 6-8 SSD, and 2 open M.2 NVMe. However, I am not filling everything up anytime soon. I do plan to start with 8 - seagate Exos 8TB drives, and leverage Intel Optane DC P4801X 100 GB m.2 for my SLOG devices. The one area that I am still torn with is if it is better to do 2 - RaidZ2 vdev, or 4- mirror vdev. Given zfs limitation as how you grow the pool, I am bias toward the mirror configuration. Someone from here already talk me out of using RaidZ1.
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
There is a flaw in 12.0 that is causing people problems with their iSCSI / VM hosting. In that use case, I would say it is best to stay with 11.3 for now. Check the bug tracker for more detail. I would link to it, but that is hard to do for me as I am on my phone at the moment.
 

Netfreak

Dabbler
Joined
Jul 22, 2017
Messages
22
I am faced eye to eye with:
"SAVE CONFIG" - What does it really save?
"RESET CONFIG" - What does it reset?

I did a test with TrueNAS-13.0.u3.1 on an old P4 HP7700.
I made some test folders with some random data within the folders and sub-folders.
I made a snapshot and did a "SAVE CONFIG" at that stage.

To see what's going to happen...
I then deleted some folders I created with it's corresponding data and then did a reload of the config file
After the config was uploaded. I didn't get back the folders with the data I deleted. So I did a rollback of my snapshot and that brought back the deleted folders & data.
After the config upload and rollback I noticed my machine was automatically rebooting a few times. Is that a normal process?

What happens when a pool is deleted?
To find that out... I deleted the pool and upload the config file
Result:
No pool and no snapshots were retrieved - the snapshots go away together with the pool (as this was created within the pool) - meaning all data are GONE.
Groups, users and shares are still intact in the setup. I wonder what good are the shares in the setup when pools and folders are gone?

Thanks in advance.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
To see what's going to happen...
I then deleted some folders I created with it's corresponding data and then did a reload of the config file
You deleted files/folders from the data pool, nothing to do with the config, so no surprises when it didn't come back with a config restore.

After the config was uploaded. I didn't get back the folders with the data I deleted. So I did a rollback of my snapshot and that brought back the deleted folders & data.
Your pool (and the snapshots in it) are local to that pool, so were not impacted by the config restore. That's correct/normal/expected.

What happens when a pool is deleted?
Depends what you mean by deleted (since there's no such operation in TrueNAS nor ZFS).

If you mean ZFS destroy, then that's a pool specific thing and has nothing to do with the config. Pools can be recovered under some circumstances after a destroy operation, but don't count on it.

If you did an export/disconnect of the pool from TrueNAS GUI, then depending on the selections you made on that screen, you may either land with an exported pool that's perfectly healthy and intact, just not imported to TrueNAS, or with a bunch of disks which are wiped and no pool.

the snapshots go away together with the pool (as this was created within the pool) - meaning all data are GONE.
True

Groups, users and shares are still intact in the setup. I wonder what good are the shares in the setup when pools and folders are gone?
Those are in the config, so no surprises.

If you were to create/restore a pool with the same name and structure/data on it, the shares would still work.

If you want an entire backup of what's on your system, you need a config backup (covering the boot pool or more specifically system settings) and a backup of your data pool(s). Those are different things and both necessary to recover an entire system.
 
Last edited:

Netfreak

Dabbler
Joined
Jul 22, 2017
Messages
22
You deleted files/folders from the data pool, nothing to do with the config, so no surprises when it didn't come back with a config restore.


Your pool (and the snapshots in it) are local to that pool, so were not impacted by the config restore. That's correct/normal/expected.


Depends what you mean by deleted (since there's no such operation in TrueNAS nor ZFS).

If you mean ZFS destroy, then that's a pool specific thing and has nothing to do with the config. Pools can be recovered under some circumstances after a destroy operation, but don't count on it.

If you did an export/disconnect of the pool from TrueNAS GUI, then depending on the selections you made on that screen, you may either land with an exported pool that's perfectly healthy and intact, just not imported to TrueNAS, or with a bunch of disks which are wiped and no pool.


True


Those are in the config, so no surprises.

If you were to create/restore a pool with the same name and structure/data on it, the shares would still work.

If you want an entire backup of what's on your system, you need a config backup (covering the boot pool or more specifically system settings) and a backup of your data pool(s). Those are different things and both necessary to recover an entire system.
Thanks for the explanation(s) and confirmation...
Yeah, sorry I used the wrong word - I meant Destroy.
I still have to try out a few different scenarios in both CORE and SCALE. I am glad I have the options here on 2 different systems to do some practical tests - I am still not sure what SAVE CONFIG really saves and what "RESET CONFIG" really resets? I hope to get some answers from my up coming tests.
Thanks for your patience
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
out a few different scenarios in both CORE and SCALE. I am glad I have the options here on 2 different systems to do some practical tests

They're basically going to do the same things.

I am still not sure what SAVE CONFIG really saves and what "RESET CONFIG" really resets?

Save config will save the appliance configuration, i.e. all the knobs and settings you can change in the GUI. It does not and cannot save the data stored on your pool, or the pool's configuration, because that's inherently managed by ZFS as part of the pool. "Reset config" will clear the appliance configuration back to factory, leaving you with a system as though it were just freshly installed. Again, this does nothing to your ZFS pool, but you may freak out a bit anyways because it also does not automatically cause the pool to be imported. You have to tell it to import the pool.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
I hope to get some answers from my up coming tests



With the two of those existing bits of documentation, I feel like you're wasting your time, but have at it.
 

Netfreak

Dabbler
Joined
Jul 22, 2017
Messages
22
Thanks for the explanation Jgreco... u save me some tests... For now no reason to freak out as I am on test machines playing/fiddling around - Gotta get some basics engraved in my brains.
Thanks for your patience.
 

Netfreak

Dabbler
Joined
Jul 22, 2017
Messages
22


With the two of those existing bits of documentation, I feel like you're wasting your time, but have at it.
Thanks Sretalla.. I have to do a better search before I post.
Thanks for your patience
 
Top