Create zfs mirror by adding a drive?

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,458
As a last resort, you could try switching back to the old GUI in 11.3.
This is no longer an option in 11.3.
 

kmo12345

Cadet
Joined
Jul 5, 2020
Messages
2
I am running FreeNAS-11.3-U2 and have a two drive mirror of 7 year old drives. One of the drives just failed and was successfully replaced but since the original drives were so I old I went ahead and bought two new ones.

Do these commands work on 11.3-U2 and would they allow me to convert my two-drive mirror to a three-drive mirror?

Reading the ZFS documentation this seems trivial but I know FreeNAS uses gptid instead of the device names and I would like this to properly show in the GUI.

Code:
config:

        NAME                                            STATE     READ WRITE CKSUM
        bigpool                                         ONLINE       0     0 0
          mirror-0                                      ONLINE       0     0 0
            gptid/e1e472ac-bf35-11ea-92ac-001e6745f355  ONLINE       0     0 0
            gptid/2f1a818e-7c42-11ea-ab0a-001e6745f355  ONLINE       0     0 0

errors: No known data errors
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,702
You should be able to do it all via the GUI.

add the third disk first, then replace the "old" one.

Depending on how many slots you have in your hardware, you may be able to leave all 4 disks in before detaching the old one to leave 3 good ones in the mirror.
 

kmo12345

Cadet
Joined
Jul 5, 2020
Messages
2
So the failed 4TB drive is completely dead. FreeNAS doesn't even detect it so I have replaced it with a 6TB. Now I have the mirror as shown above with one 4TB and one 6TB. On the Disk page I see the three drives, two are in the pool, and one is unused.

In the Pool GUI the only option seems to be Extend Pool.

On the Extend Pool page I am getting a warning WARNING: Adding data vdevs with different numbers of disks is not recommended. First vdev has 2 disks, new vdev has 1.

There doesn't seem to be an attach drive option.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,702
You need to do it from the Status option for the pool (cogwheel then status) in the Storage section.

The operation should happen at the mirror level to extend.
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,175
Wait, are you saying that mirror manipulations can be done with the GUI? Since what version? There is /was a longstanding feature request for that that I do not remember seeing closed.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,702
Wait, are you saying that mirror manipulations can be done with the GUI? Since what version? There is /was a longstanding feature request for that that I do not remember seeing closed.
Well, maybe that's a good point... I didn't have a mirror to test on any of the prod systems I checked on quickly, so looked on my dev system, which is of course now TrueNAS Core 12 Beta (which has the feature you're after).

A more thorough check of my 11.3 systems found a mirror and indeed it's missing... sorry about the confusion.
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,175
At least there's a bit of good news in there. The feature is finally coming!

So the failed 4TB drive is completely dead. FreeNAS doesn't even detect it so I have replaced it with a 6TB. Now I have the mirror as shown above with one 4TB and one 6TB. On the Disk page I see the three drives, two are in the pool, and one is unused.

In the Pool GUI the only option seems to be Extend Pool.

On the Extend Pool page I am getting a warning WARNING: Adding data vdevs with different numbers of disks is not recommended. First vdev has 2 disks, new vdev has 1.

There doesn't seem to be an attach drive option.
To answer your question, the same procedure to turn a single disk into a two-way mirror can be applied to turn a two-way into a three-way mirror. Unfortunately, it'c CLI-only for now.
 

kmo12345

Cadet
Joined
Jul 5, 2020
Messages
2
At least there's a bit of good news in there. The feature is finally coming!


To answer your question, the same procedure to turn a single disk into a two-way mirror can be applied to turn a two-way into a three-way mirror. Unfortunately, it'c CLI-only for now.

Okay cool. Thought I was losing my mind because I clicked through everything multiple times and couldn't figure it out.

Re: the CLI procedure
Does the procedure a few pages back in this thread still work in the 11.3 web interface? Does the newly attached drive show up on the Status page once added from the CLI?

Thanks for all the help.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,702
The CLI process works across pretty much every version including the latest ones.

You will be able to see the vdev members correctly in the GUI.
 

Jord9857

Explorer
Joined
Apr 28, 2020
Messages
74
Hi,

I'm looking to setup disk mirroring to my hard drives. I currently have a pool which has 1 disk with Plex jail on and media, and currently setting up another pool with 1 disk which will have media on as well.

I want to add a disk to both of the pools to mirror incase the first one dies.

From reading the forums, I'm guessing the only way to do this is using shell.

Does it matter whether it's an encrypted pool or not? & is there an updated version of this code to add this disk mirroring please?
 

Spec

Dabbler
Joined
Aug 14, 2016
Messages
12
Ok, I tested the procedure out in a VM running FreeNAS.
...
Has anyone confirmed if its possible to turn a single encrypted disk into an encrypted mirrored array in FreeNAS 11.2 (using the instructions from post 56/57).

(a) 1x Intel 80GB SSD - boot - FreeNAS 11.2U8
(b) 1x Intel 80GB SSD - jails - encrypted
(c) 1x Crucial 1TB MX500 SSD - unallocated
(d) 1x Crucial 1TB MX500 SSD - unallocated

My intention is to create a mirror with (b) and (c), after the resilver completes replace the (b) with (d), then expand the (c)+(d) mirror from 80GB to 1TB.
(b) would then be added to (a) to create a mirrored boot volume.
I'm stuck with 11.2 at the moment as I'm part way through migrating jails to iocage and need the space that the new disks will provide.

Is this possible in 11.2U8?
Thanks
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
encrypted disk
Is there a way you can remove encryption from the system?

I wouldn't use encryption to begin with, but if I were in the predicament you are in, I would just create a new pool with the new disks and do a ZFS send and receive to make a full copy on the new pool, then switch the new pool for the old pool. It might be simpler than dealing with the encryption.
 

Spec

Dabbler
Joined
Aug 14, 2016
Messages
12
Is there a way you can remove encryption from the system?
...
Is it possible to use ZFS send and receive between 2 unlocked encrypted pools?
What if I created a new encrypted pool - 2x Crucial 1TB mirrored - and did a ZFS send and receive from the Intel 80GB pool to the Crucial 1TB pool?
I would imagine this breaks the jails with it being a different pool name, however the GUI allows you to change the dataset where the jails reside.
This might be ok for my iocage jails(?), but I still have some warden jails originally created in 9.3 that I access from the legacy GUI - would they break or move across ok?
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
would they break or move across ok?
I have not tested this, but if it were to stand any chance of working, you would need to stop all the jails while you are doing it so no data is being changed.
My thinking is that you would be able to do ZFS send on the entire pool, to the new pool. Once the ZFS send and receive is completed, you could use the GUI to export the pools without destroying them. Then you would need to use the command line to use zpool import (pool-name) (new-pool-name) to change the name of the 1TB pool to match the old pool name. Then you would export the pool again from the CLI.
Sorry it is a bit cumbersome because the GUI does not provide a mechanism to rename the pool. This is it.
At this point, you probably need to remove the 80GB pool from the system and go back to the GUI to import the new pool. If it works as I theorize it might, you should be able to import the pool from the GUI and start the VMs. The VMs might have no problem as the pool name / mount point will match what they are expecting.

All of that is completely ignoring any potential pitfalls due to encryption. The new version of FreeNAS (TrueNAS) has a different kind of encryption, so I would suggest moving out of the existing encryption if at all possible so you can prepare for the new form of encryption with TrueNAS.
 

Spec

Dabbler
Joined
Aug 14, 2016
Messages
12
I have not tested this, but if it were to stand any chance of working, you would need to stop all the jails while you are doing it so no data is being changed.
....
This sort of worked.
I created an encrypted pool called ssd2 consisting of 2x Crucial 1TB as a mirror.
Used zfs send/receive to transfer the latest snapshot of pool ssd1 (1x Intel 80GB) to pool ssd2.
zpool export ssd1
zpool export ssd2
zpool import ssd1 original_ssd1
zpool import ssd2 ssd1
Bearing in mind both pools were already unlocked/decrypted at this point - it allowed ssd2 pool to appear as ssd1 in the GUI > Pools config. However when I rebooted, the GUI got confused as it was expecting the original pools in ssd1 and ssd2 - GUI > Pools page took forever to load and eventually said both ssd pools were unavailable.
I unlocked and imported them to the original locations to ensure everything was still working.

It seems the GUI keeps extra data about the pools, or the pools store their original name within their data, either way it didn't work fully.

If I export/disconnect both ssd pools from the GUI > Pools area without destroying data or deleting configuration of shares, will the GUI then let me import ssd2 pool and name it ssd1?
EDIT - nope, the GUI only lets you select the original name of the pool when importing it again. Its not editable.
 
Last edited:

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
It seems the GUI keeps extra data about the pools, or the pools store their original name within their data, either way it didn't work fully.
No. You skipped steps. I said, after doing the import to change the name, you would need to export it again, from the CLI. Then remove from the system the 80 GB drive. Then, when you reboot the system, use the GUI to import the 1TB SSD pool and it will keep the name you assigned at the CLI. You ran into problems because you had two pools with the same name still in the system.
 

Spec

Dabbler
Joined
Aug 14, 2016
Messages
12
No. You skipped steps.
...
Apologies I did that that but failed to mention what happened in my reply.
Once I exported/disconnected from the GUI the pools become locked as they are encrypted and I didn't know how to unlock them via the command line without doing through the GUI. zpool import then failed as it cant find the pool.

I did however just try the following:
Pools ssd1 (80GB single) and ssd2 (1TB mirror) mounted and unlocked via GUI
zpool export ssd1
zpool export ssd2
zpool import ssd1 original_ssd1
zpool import ssd2 ssd1
zpool export original_ssd1
zpool import original_ssd1 ssd2 << I think this is what I missed first time around that caused the GUI to throw a wobbler.
Now both pools are swapped around, I have the new 1TB mirror in place of ssd1 where the jails were originally located and the original 80GB pool is moved to ssd2 (nothing is configured to use this pool).
I exported and imported both pools again via the GUI - they both picked up the new locations.

With both ssd pools appearing to be in their new location without errors I rebooted, unlocked all pools via GUI and selected all services to restart with the last pool unlocking. In the Jails section I had to reactivate them by selecting ssd1, it picked up my iocage jails and started fine, logged into the legacy GUI and my old warden jails had started automatically :)

All seems well, thanks for the help!
 

Chris Moore

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

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
EDIT - nope, the GUI only lets you select the original name of the pool when importing it again. Its not editable.
That is the reason for doing the import at the CLI, it is the only way the OS allows a pool to get a different name. Once it is imported with a name change at the CLI, you must export it at the CLI, then import it again through the GUI to get it to be mounted correctly in FreeNAS / TrueNAS. That is because the NAS operating system has some (what they call) middle-ware that does extra things behind the scenes that doesn't get done from the CLI.
 
Top