How to recover and upload a config file from an imported pool?

Pmikeyreid

Dabbler
Joined
Jul 12, 2023
Messages
11
Hi Folks,

First off if this has been asked and answered I apologize, I've been looking at the threads for the last hour and can't seem to find the answer. The short version of the story is that the SSD containing my TruenNAS OS bit the dust, I have gotten a fresh SSD, re-installed TrueNAS Scale, and have imported my existing pool into the new install. Now because I didn't quite understand what I was doing, I didn't save my config file to an external source (lesson learned). I have read in the forums that there is the possibility that I might be able to recover the config file from the pool, however I'm not sure where to look, and if I find it, what to do. Any help walking me through the process would be much appreciated.

Here's as far as I've made it, but I'm not sure what I'm looking at.
Screen Shot 2023-08-24 at 12.54.34 AM.png


Thanks so much.

Motherboard: A880GU3
Memory: 8GB RAM (the max for that motherboard)
Storage: 6x2TB Hard Drives (Various brands, I know it's not ideal) - I also have a separate SSD for the boot disk.
TrueNAS Scale version: TrueNAS-SCALE-22.12.3.3.
 
Joined
Oct 22, 2019
Messages
3,641
I have read in the forums that there is the possibility that I might be able to recover the config file from the pool
From the boot-pool. (Not from a storage pool.)

But since your boot-pool was comprised of a single SSD, and that SSD "died", it means the config stored on it as gone as well. (Unless you can somehow retrieve it with recovery tools.)

That's why it's important to backup your config file elsewhere, whether manually or via a helper script, which can be found under the "Resources" section in these forums. (FYI: You're prompted to backup your config file every time you update TrueNAS.)

The screenshot you posted is of a directory that lives on the boot-pool of this current installation. It's unrelated to the dead SSD (which has your up-to-date config).
 
Last edited:

Pmikeyreid

Dabbler
Joined
Jul 12, 2023
Messages
11
Thanks for the clarification Winnie, it's much appreciated, even if it does mean I'm pretty much hooped on this one. Ah well. The data is still there so maybe I'll just take this opportunity to reinstall my apps and clean things up in the process.

Thanks again.
 
Joined
Oct 22, 2019
Messages
3,641
Don't forget to backup ("export") your config file after you set things up again. :wink:
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
From the boot-pool. (Not from a storage pool.)
This is not quite correct. The automatic config backups end up in the system data set. And the system data set is by default in the first storage pool created.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
From the boot-pool. (Not from a storage pool.)
I think you're forgetting the automatic config backups stored in the system dataset (which may well be on the storage pool).

If you can find it on your pool ... should look something like this in zfs list:

tank/.system/configs-76c11d7f8a944b3d8e42fe35420dbaa3 16.3M 344G 16.3M legacy

You can get a look at it like this:
mount -t zfs tank/.system/configs-76c11d7f8a944b3d8e42fe35420dbaa3 /mnt
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
This is not quite correct. The automatic config backups end up in the system data set. And the system data set is by default in the first storage pool created.
Hahaha... I was just looking up an old post where you had given me the command for mounting it, which allowed you to ninja me.
 

Pmikeyreid

Dabbler
Joined
Jul 12, 2023
Messages
11
I think you're forgetting the automatic config backups stored in the system dataset (which may well be on the storage pool).

If you can find it on your pool ... should look something like this in zfs list:

tank/.system/configs-76c11d7f8a944b3d8e42fe35420dbaa3 16.3M 344G 16.3M legacy

You can get a look at it like this:
mount -t zfs tank/.system/configs-76c11d7f8a944b3d8e42fe35420dbaa3 /mnt
Thanks all, so there is hope after all! I took a look and found the file that you mentioned. I'm just not sure what to do with it at this point.

Here's the screenshot of the files that I found:

Screen Shot 2023-08-24 at 11.51.45 AM.png


I picked the first one because it had the larger file size, and then when I ran the code you sent. Here's what I've got.
Screen Shot 2023-08-24 at 11.51.21 AM.png


Any help on where to go from here would be great.

Thanks so much for your help on this. I am learning a lot about how this all works. It's much appreciated.

Mike
 

Redcoat

MVP
Joined
Feb 18, 2014
Messages
2,925
You need to open that file to get at its contents. Here I use winscp to open mine:

1692890918284.png


The above is the bottom of the listing of the files in it.

Find the most current version and open it:

1692891059839.png


here you can see the automagic 03h45 saves for -U5.3

Pick the config file of the date you want to use and copy it to /data with the filename freenas-v1.db

I think you may be able to use the "Upload config" of System>General and specify the path and filename of the backup file, but I have not done that for some time and I do not know if it still "works". Perhaps someone here with current knowledge can confirm/refute ...
 
Joined
Oct 22, 2019
Messages
3,641
The automatic config backups end up in the system data set. And the system data set is by default in the first storage pool created.
That's a "Doh!" moment for me. I forgot that most people don't move their System Dataset back to the boot-pool.
 
Joined
Oct 22, 2019
Messages
3,641
I appreciate the help! your "doh" moment helped point me in the right direction
Yesss. YESSSSSSSSSSS. It was my "Doh!" moment that truly helped you, not those foolish plebes who actually gave you accurate information.
 smirking face Emoji on Apple Platform


Mwahahahahaha! My master plan is almost complete!
43973.png
 

Pmikeyreid

Dabbler
Joined
Jul 12, 2023
Messages
11
Yesss. YESSSSSSSSSSS. It was my "Doh!" moment that truly helped you, not those foolish plebes who actually gave you accurate information.

Mwahahahahaha! My master plan is almost complete!
lol well they totally helped MORE...but still.....
 

Pmikeyreid

Dabbler
Joined
Jul 12, 2023
Messages
11
Thanks so much for this @Redcoat . I've gotten WinSCP working, and connected as root. I used the same path as you but that just took me to the config files from the fresh install. In order to get to the one stored on the disk I somehow need to find Tank/.system/configs-bd26c8fd36fd4618a75dffa52c04f828

As close as I can figure the path I want is "mnt/Tank/.system/etc.", but I can't see .system anywhere in the directory. I'm guessing it's hidden, but I enabled show hidden files with no luck.

Thoughts?
 
Joined
Oct 22, 2019
Messages
3,641
Its quite possible that there's a new unique identifier dataset name for the relevant children datasets.

You can confirm with this, which will clue you into which child dataset to (temporarily) mount.
Code:
zfs list -t filesystem -r -o name Tank/.system

You might see "duplicate" datasets listed, with a different appended unique string.


You can compare it to this output, which will show you the currently mounted datasets. My hunch is that the currently mounted ones are irrelevant to the config file you wish to extract. Which means you'll have to temporarily mount the "older" one:
Code:
zfs mount | grep -F .system


You won't be able to access its contents, even with WinSCP, if it's not mounted in TrueNAS. So you need to manually mount it first, as TrueNAS's middleware will not do this automatically if it's using a different (newer) dataset to house your "config-XXXX" contents.
 
Last edited:

Redcoat

MVP
Joined
Feb 18, 2014
Messages
2,925
I just reaized you are on Scale - aboiut which I know nothing. I likley have just fed you a big fat red herring...
 

Pmikeyreid

Dabbler
Joined
Jul 12, 2023
Messages
11
Evening @Redcoat , @winnielinnie, @sretalla, @Patrick M. Hausen and anyone else who has been anxiously awaiting the resolution of this mind blowing adventure:

After a fair amount of fiddling and the realization that it would probably have been faster to just re-install everything, I managed to recover and upload the old config file by combining different pieces of all the advice that you folks provided. In the hopes of helping out anyone with a similar issue I've outlined the basic process I used below. If you are reading this and need some more details feel free to drop me a line.

Just as a quick recap - Running TrueNAS Scale, Boot SSD Died, I am bad at backups, the goal was to recover an old config file from the existing storage pool so I didn't have to set everything up again on the new install.


Step 1 - get a new SSD and install a shiny new copy of TrueNAS Scale (I am on a private network, so set it up as Root User)

Step 2 - Import existing pool

Step 3 - See if the config files are actually somewhere in the pool by going into shell and using the code:
Code:
zfs list
- If it is there, it will look something like this: tank/.system/configs-76c11d7f8a944b3d8e42fe35420dbaa3 16.3M 344G 16.3M legacy (if there are a couple, pick the one with the bigger file size)

Step 4 - If it looks like the file is there, Install WinSCP on whatever computer you are using to access your TrueNAS server ( I'm assuming you are using the web interface), and configure it to connect to your TruenNAS machine via SCP. There's lots of info on how to do this, so I won't go into it here, but i connected as the user 'root' to make sure I had access to everything. Once it's all set up, close WinSCP for now.

Step 5 - Back in Shell, use the code
Code:
mount -t zfs tank/.system/configs-76c11d7f8a944b3d8e42fe35420dbaa3 /mnt
to mount the config directory - be sure to change the path to whatever yours is.

Step 6 - Once that directory has been mounted, head back into WinSCP and connect to your TrueNAS machine.

Step 7 - Navigate to /mnt and you should see two folders, one being the current version of scale you are running, and the other being the older version that you were using when your boot drive died. Pick the older one.

Step 8 - Feast your eyes on all the delightful backed up config files that TrueNAS quietly made because it knew one day it would have to save you from yourself.

Step 9 - Download the most recent one ( for me it was at the bottom) to your computer (not the one running TrueNAS, that would be silly, the one you are using to run winSCP

Step 10 - Back in Scale, go to system setting --> General --> then in the upper right hand corner of the screen click Manage Configuration, upload config file.

Then you just navigate to wherever you saved the file on your computer, click it, and voila! Things will happen. TruNAS will restart, settings will change, apps will download (This could take some time depending on how much stuff you have running) and all will be right in the world.

Thanks so much to all the folks listed above, they gave me all the pieces I needed to get this sorted . If nothing else this has been a great learning experience for me, and hopefully laying it all out helps someone else.

Have a great night.

M.
 
Joined
Oct 22, 2019
Messages
3,641
Great follow-up and write-up!

There's just one thing I would advise against, and to change in your steps:
mount -t zfs tank/.system/configs-76c11d7f8a944b3d8e42fe35420dbaa3 /mnt

Do not use /mnt as the mountpoint. Even if it's only temporary. This is used as the altroot for TrueNAS's storage pools by default. I would advise you create a temporary subdirectory, and then mount it there, like so:

Code:
mkdir /mnt/recovery
mount -t zfs tank/.system/configs-76c11d7f8a944b3d8e42fe35420dbaa3 /mnt/recovery
 
Top