Can I safely import ZPOOLs that were not exported?

NASbox

Guru
Joined
May 8, 2012
Messages
650
Can I safely import ZPOOLs that were not exported? I would like to mount pools that were not cleanly exported. Is it safe to boot a FreeNAS install USB into Shell and then import the boot drive, or the data pools?

When I attempted zpool import freenas-boot, I got a message that 'pool may be in use on another system', and there is a reference to the hostname of my freenas system. I know there is a -f option, but I need guidance as to the safety of using it.

Has anyone done this?
 

melloa

Wizard
Joined
May 22, 2016
Messages
1,749
zpool import freenas-boot

That is not your pool...

From the GUI you can do that, under the pool menu. If that won't work, go to the shell and type:

Code:
zpool import


That will list the available pools to be imported.

zpool import <pool_name> will import a listed pool from above.

Some times you will need to force it.

Again, try first from the GUI.
 

melloa

Wizard
Joined
May 22, 2016
Messages
1,749
For reference:

1568760665533.png
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
Thanks for the reply @melloa - I guess I haven't made my intent clear. I am asking about a rescue operation-from the shell option of an install USB
.
I am aware freenas-boot is the boot pool. I have a small custom directory on it mounted /CUSTOM

Some times you will need to force it.
Again, try first from the GUI.

In this case there will be no GUI, I will be running in a shell.

The questions are:
What are the implications of forcing it?
What is the likelyhood of corrupting a pool (assuming it isn't already corrupted)?
Am I going to have difficulty getting it to re-import to FreeNAS when I get it fixed and reboot it?

PS: I did manage to get freenas back up again this time, but I want to learn about the rescue/recovery process BEFORE I need it.
 
Joined
Oct 18, 2018
Messages
969
PS: I did manage to get freenas back up again this time, but I want to learn about the rescue/recovery process BEFORE I need it.
If you backup your system config, don't store anything custom on the freenas-boot pool, and keep backups of all encryption keys if you use encryption you have all you need to easily recover. Just reinstall FreeNAS on another boot device, import the above backed up configs and keys and you're all set.
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
If you backup your system config, don't store anything custom on the freenas-boot pool, and keep backups of all encryption keys if you use encryption you have all you need to easily recover. Just reinstall FreeNAS on another boot device, import the above backed up configs and keys and you're all set.
I am aware of that... I still would like to know the ins and outs of manipulating pools from the command line. I don't really want to give up my /CUSTOM directory. I do back it up to the pool from time-to-time, but it's much more convenient to to have to recreate.
 
Joined
Oct 18, 2018
Messages
969
I am aware of that... I still would like to know the ins and outs of manipulating pools from the command line. I don't really want to give up my /CUSTOM directory. I do back it up to the pool from time-to-time, but it's much more convenient to to have to recreate.
You can find various zfs docs online for importing and exporting pools. Generally we advice folks try to stick to the GUI where possible because FreeNAS uses certain flags etc to manage the pools that are best left to FreeNAS. Your case sounds like one where the GUI doesn't support it, though it does seem a bit odd of a use case; though I'm sure you've considered other options and decided this is the best. If I'm understanding correctly you've just got a pool with a custom mount point? In order to offer specific help it would be useful to know exactly what your system is like and how it got that way.

PS: I did manage to get freenas back up again this time, but I want to learn about the rescue/recovery process BEFORE I need it.
My favorite approach is to use zfs replication to onsite and offsite backups. If something catastrophic happens I'll just use those backups. If my main boot pool simply fails I'll just reinstall and upload my configs.
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
Thanks for the response @PhiloEpisteme
You can find various zfs docs online for importing and exporting pools. Generally we advice folks try to stick to the GUI where possible because FreeNAS uses certain flags etc to manage the pools that are best left to FreeNAS. Your case sounds like one where the GUI doesn't support it, though it does seem a bit odd of a use case; though I'm sure you've considered other options and decided this is the best. If I'm understanding correctly you've just got a pool with a custom mount point? In order to offer specific help it would be useful to know exactly what your system is like and how it got that way.

Here is what my boot pool looks like:

Code:
freenas-boot                                                   10.7G  96.8G   176K  none
freenas-boot/.system                                            169M  96.8G  4.34M  legacy
freenas-boot/.system/configs-66c5ca0d9b594eb08a0e7191ec86e4a6  72.2M  96.8G  72.2M  legacy
freenas-boot/.system/configs-9d613bc4d69d4caa9ab03b2439285b53   136K  96.8G   136K  legacy
freenas-boot/.system/cores                                     16.4M  96.8G  16.4M  legacy
freenas-boot/.system/rrd-66c5ca0d9b594eb08a0e7191ec86e4a6      33.0M  96.8G  33.0M  legacy
freenas-boot/.system/rrd-9d613bc4d69d4caa9ab03b2439285b53      3.85M  96.8G  3.85M  legacy
freenas-boot/.system/samba4                                     476K  96.8G   476K  legacy
freenas-boot/.system/syslog-66c5ca0d9b594eb08a0e7191ec86e4a6   38.6M  96.8G  38.6M  legacy
freenas-boot/.system/syslog-9d613bc4d69d4caa9ab03b2439285b53    296K  96.8G   296K  legacy
freenas-boot/CUSTOM                                             163M  96.8G  78.4M  /CUSTOM
freenas-boot/ROOT                                              10.3G  96.8G   136K  none
freenas-boot/ROOT/11.0-U3                                       232K  96.8G   970M  /
freenas-boot/ROOT/11.0-U4                                       248K  96.8G   973M  /
freenas-boot/ROOT/11.1-RELEASE                                  424K  96.8G  1.08G  /
freenas-boot/ROOT/11.1-U4                                       452K  96.8G  1.09G  /
freenas-boot/ROOT/11.1-U5                                       452K  96.8G  1.10G  /
freenas-boot/ROOT/11.1-U6                                       572K  96.8G  1.10G  /
freenas-boot/ROOT/11.1-U6.3                                     440K  96.8G  1.04G  /
freenas-boot/ROOT/11.1-U7                                      9.32G  96.8G  1.07G  /
freenas-boot/ROOT/Initial-Install                                 8K  96.8G   980M  legacy
freenas-boot/ROOT/default                                       232K  96.8G   980M  legacy
freenas-boot/ROOT/default-20190917-081209                      1018M  96.8G  1018M  legacy
freenas-boot/grub                                              7.94M  96.8G  7.94M  legacy


the only customization is: freenas-boot/CUSTOM 163M 96.8G 78.4M /CUSTOM

and I also have the system database on the boot drive (I forgot about that). I'm assuming that a reinstallation would recreate it? Or maybe this isn't still in use? I've been upgrading in place since v8.3, and this is the first time in about 8 years that I've had a problem booting.

freenas-boot/CUSTOM has my custom /bin cron and maintenance scripts. I want them available if for some reason I have a pool offline. Also a bit of history, back in the 8.3 day, I was using 3TB Seagate desktop drives that were not rated 24/7, and I spun the pool down to save the drives. Now I am using WD Reds that spin 24/7/365, which is a horrible waste of power but so be it. I don't really want to relocate /CUSTOM if I can avoid it.

Now that I've seen how non-distructive an upgrade is, I'll likely try it first.

FreeNAS uses certain flags etc to manage the pools that are best left to FreeNAS.

As long as I'm not changing flags do I have to worry? This is really the main point of my post. I know how to import a pool, I just don't know if there are important implications like NOT using -f or something like that.

My favorite approach is to use zfs replication to onsite and offsite backups. If something catastrophic happens I'll just use those backups. If my main boot pool simply fails I'll just reinstall and upload my configs.
I wish I had something to replicate to... don't have the space for a second system... this is a residential setup where I am the owner/admin and main user (backup the wife's computer), and she will occasionally access a library of educational material from a read only share.

A bit off topic, but how can I script my backup? When something has to be done though a GUI, it tends to get forgotten. I would love to be able to automate backup, but I don't want to backup all the installed code - just the user data so I can restore through the GUI like normal.

My last backup was August (which should be fine for /CUSTOM, but I don't know about other system settings. I usually do a backup before and after an update, (and copy /CUSTOM when I make changes-infrequent), and you can see that I'm being very conservative since I'm still on 11.1-U7. I don't have time to mess with updates till about November, so I'll likely step up to 11.2-U5/6/7 or whatever seems stable, or maybe even 11.3
 
Joined
Oct 18, 2018
Messages
969
the only customization is: freenas-boot/CUSTOM 163M 96.8G 78.4M /CUSTOM
freenas-boot/CUSTOM has my custom /bin cron and maintenance scripts. I want them available if for some reason I have a pool offline. Also a bit of history, back in the 8.3 day, I was using 3TB Seagate desktop drives that were not rated 24/7, and I spun the pool down to save the drives. Now I am using WD Reds that spin 24/7/365, which is a horrible waste of power but so be it. I don't really want to relocate /CUSTOM if I can avoid it.
Interesting. I'd imagine a properly configured pool would be able to keep this data safe; or at least as safe as any other data you keep on the pool. Typically, because the boot pool contains easily recoverable configs the boot pool is more likely to lose data. If you're sitting on a single boot disk that is way more likely to die and take everything with it than a pool backed by vdevs with appropriate redundancy.

I'm assuming that a reinstallation would recreate it? Or maybe this isn't still in use? I've been upgrading in place since v8.3, and this is the first time in about 8 years that I've had a problem booting.
As far as I know, as long as you don't put anything else on the boot pool if you keep a backup of your system config and any encryption keys you have if you're using encryption you're find if your boot pool bites the dust. There are a few ssh keys and the like which will have to be recreated but that isn't a huge deal; everything else should work just fine with the system config you have and the encryption keys.

As long as I'm not changing flags do I have to worry? This is really the main point of my post. I know how to import a pool, I just don't know if there are important implications like NOT using -f or something like that.
Sorry, I can't help you there. I seem to recall some advice on the forums recommending not forcing an import in the event is causes issues; the suggestion was to save -f for only when you absolutely must.

I wish I had something to replicate to... don't have the space for a second system... this is a residential setup where I am the owner/admin and main user (backup the wife's computer), and she will occasionally access a library of educational material from a read only share.
Totally get it. One option would be to back up to the cloud; another would be to pick up an external SAS expander case where you can put large drives in for a quick backup. It all depends on your budget of course and how important losing your data is. Keep in mind though that no amount of redundancy will replace a backup and an on-site backup will burn up just as well as your main system in the event of a fire etc. Whatever backup strategy is right for your situation is 100% your call. If you are interested in developing one I think it would be appropriate to do some research and post to the forums including what kind of budget you have and how much data you are backing up.
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
Interesting. I'd imagine a properly configured pool would be able to keep this data safe; or at least as safe as any other data you keep on the pool. Typically, because the boot pool contains easily recoverable configs the boot pool is more likely to lose data. If you're sitting on a single boot disk that is way more likely to die and take everything with it than a pool backed by vdevs with appropriate redundancy.

Agreed... I'm not super worried about it since I do back it up to the main pool....

As far as I know, as long as you don't put anything else on the boot pool if you keep a backup of your system config and any encryption keys you have if you're using encryption you're find if your boot pool bites the dust. There are a few ssh keys and the like which will have to be recreated but that isn't a huge deal; everything else should work just fine with the system config you have and the encryption keys.

Isn't there a system dataset? I think it could either be on the boot or some other pool. It has been so long.... I think when I installed v11 (whenever UFS went away).

Sorry, I can't help you there. I seem to recall some advice on the forums recommending not forcing an import in the event is causes issues; the suggestion was to save -f for only when you absolutely must.

It would be nice if someone sees this who can fill in a bit more so I have an idea what the situation is.

Totally get it. One option would be to back up to the cloud; another would be to pick up an external SAS expander case where you can put large drives in for a quick backup. It all depends on your budget of course and how important losing your data is. Keep in mind though that no amount of redundancy will replace a backup and an on-site backup will burn up just as well as your main system in the event of a fire etc. Whatever backup strategy is right for your situation is 100% your call. If you are interested in developing one I think it would be appropriate to do some research and post to the forums including what kind of budget you have and how much data you are backing up.

So far I am using single disk pools on removable drives to back up to. Not great, but better than nothing.
 
Joined
Oct 18, 2018
Messages
969
Isn't there a system dataset? I think it could either be on the boot or some other pool. It has been so long.... I think when I installed v11 (whenever UFS went away).
Yes, there is. You can check under the settings which pool you have the system dataset stored on. Here is an example in the current version of FreeNAS.
 
Top