Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

Create zfs mirror by adding a drive?

Western Digital Drives - The Preferred Drives of FreeNAS and TrueNAS CORE

Knowltey

Senior Member
Joined
Jul 21, 2013
Messages
430
Yeah, that command just clears the error count. Run zpool clear and then immediately do a zpool scrub to ensure that it isn't an actual error.
 

Pontiac75

Junior Member
Joined
Aug 9, 2014
Messages
18
Thanks. I cleared the error message using "zpool clear" and then performed a scrub. Zero errors :)

I guess the single checksum flag occured due to the drive being disconnected and reconnected.

I'll leave this thread alone now, but it's been a great learning experience for a noob. Cheers!
 

Knowltey

Senior Member
Joined
Jul 21, 2013
Messages
430
Thanks. I cleared the error message using "zpool clear" and then performed a scrub. Zero errors :)

I guess the single checksum flag occured due to the drive being disconnected and reconnected.

I'll leave this thread alone now, but it's been a great learning experience for a noob. Cheers!
It was probably just something that happened to be detected during the resilvering process.
 

jakeandchase

Member
Joined
Aug 26, 2014
Messages
53
Getting "cannot attach /dev/gptid/<rawuuid2> to /dev/gptid/<rawuuid1>: no such device in pool"
 
Last edited:

Scharbag

Senior Member
Joined
Feb 1, 2012
Messages
504
Let's assume ada0 is your existing disk, ada1 is the new one, tank is the pool name.
  1. gpart create -s gpt /dev/ada1
  2. gpart add -i 1 -b 128 -t freebsd-swap -s 2g /dev/ada1
  3. gpart add -i 2 -t freebsd-zfs /dev/ada1
  4. Run zpool status and note the gptid of the existing disk
  5. Run glabel status and find the gptid of the newly created partition. It is the gptid associated with ada1p2.
  6. zpool attach tank /dev/gptid/[gptid_of_the_existing_disk] /dev/gptid/[gptid_of_the_new_partition]
Test this first in a VM to verify that you understand everything.

Edit: Updated the steps to create the default 2GB swap partition.
So, assuming my stripe SSD that I want to mirror is da12 and da15 is the next available, once I insert the new drive I perform the above using da15 in place of the ada1? Once this is done, then I will see a GPTID listed for da15 when I execute glabel status correct?

Thank you for the great post! This worked like a charm. I even somewhat understood what was going on!!

Cheers,
 
Last edited:

Pontiac75

Junior Member
Joined
Aug 9, 2014
Messages
18
I've now upgraded to FreeNAS 9.3.

Does anyone know if this method still works with the latest version?
 

Scharbag

Senior Member
Joined
Feb 1, 2012
Messages
504
I just did this a few days ago on my 9.3 system and it worked perfectly. Added a second SSD to my single disk fast pool to make it a mirror.

Cheers,
 

Pontiac75

Junior Member
Joined
Aug 9, 2014
Messages
18
I'm going to have a go in the next couple of days. Cheers.

Edit: I have now resilvered a new HDD I got at Christmas using the guide in this thread and it worked fine on 9.3. :smile:
 
Last edited:

jarge11

Junior Member
Joined
Mar 13, 2014
Messages
20
I get

Code:
[root@freenas] ~# zpool attach tank /dev/gptid/0f0b0ca1-9bea-11e4-9afd-10604b92bc3c /dev/gptid/cba87a20-c413-11e4-88d7-10604b92bc3c
cannot open 'tank': no such pool
 

Dat Sysadmin

Member
Joined
Feb 4, 2015
Messages
143
I get

Code:
[root@freenas] ~# zpool attach tank /dev/gptid/0f0b0ca1-9bea-11e4-9afd-10604b92bc3c /dev/gptid/cba87a20-c413-11e4-88d7-10604b92bc3c
cannot open 'tank': no such pool
I don't mean to sound rude, but can you please re-read the error message? It looks pretty self-explanatory to me.
 

Towawi

Newbie
Joined
Aug 30, 2015
Messages
2
I have a few questions relating to this thread. I hope some of them aren't too off-topic...
  1. I have a 3TB volume comprised of three 1TB disks in a striped configuration and I'm wanting to add redundancy to this volume by adding another 3TB volume, this time consisting of a single 3TB disk. Is this possible?
  2. Can the task described above be done via the Web GUI? (If not, why is it that some seemingly simple tasks can be done via the Web GUI, and others cant? Eg, We can extend an existing volume via the Web GUI but not add redundancy?)
  3. Is it true that some changes made "behind the scenes" via shell are not retained after a restart?
Thank you to those that help :)
 

danb35

Wizened Sage
Joined
Aug 16, 2011
Messages
11,949
I have a 3TB volume comprised of three 1TB disks in a striped configuration and I'm wanting to add redundancy to this volume by adding another 3TB volume, this time consisting of a single 3TB disk. Is this possible?
No.
Can the task described above be done via the Web GUI? (If not, why is it that some seemingly simple tasks can be done via the Web GUI, and others cant? Eg, We can extend an existing volume via the Web GUI but not add redundancy?)
Adding a second disk as a mirror of a first can't be done through the web GUI. We'd heard that this feature was going to be added to 9.3, but it didn't make it. We now hear that it should be in 10. I can only assume that this was found to be more complicated than expected, but I really don't know the reasoning for why it was dropped.
Is it true that some changes made "behind the scenes" via shell are not retained after a restart?
Yes.
 

Scharbag

Senior Member
Joined
Feb 1, 2012
Messages
504
One note on question 3: changes to your pools via CLI are maintained on reboot.
 

echelon5

Member
Joined
Apr 20, 2016
Messages
79
Does the guide work on 9.10 or has the method changed?

Edit: it works.
 
Last edited:

Scharbag

Senior Member
Joined
Feb 1, 2012
Messages
504
Given that this is affecting ZFS and the underlying BSD file systems and not the os, then it should still apply. I have not tested this on 9.10 though. If you try it and it works, please comment here.

Cheers
 

Stux

Wizened Sage
Joined
Jun 2, 2016
Messages
4,163
I have a few questions relating to this thread. I hope some of them aren't too off-topic...
  1. I have a 3TB volume comprised of three 1TB disks in a striped configuration and I'm wanting to add redundancy to this volume by adding another 3TB volume, this time consisting of a single 3TB disk. Is this possible?
(Yes, old post, but incorrect answer)

You can actually do this. You need to partition the 3Tb drive into 3 1Tb partitions, and hope they're big enough, luckily, swap is set at 2Gb per drive which gives you 6GB of spare space on your 3tb. Then manually add each partition as mirrors.

I've done this before, but only while testing/playing data musical chairs during a data migration. I wouldn't recommend it long term.

  1. Can the task described above be done via the Web GUI? (If not, why is it that some seemingly simple tasks can be done via the Web GUI, and others cant? Eg, We can extend an existing volume via the Web GUI but not add redundancy?)
This can not be. It's non-trivial and the FreeNAS gui does not let you operate on the partition level of any disks, it only deals in whole disks.

  1. Is it true that some changes made "behind the scenes" via shell are not retained after a restart?
Thank you to those that help :)
Always worked for me. The basic approach is to export your pool from the CLI, then re-import it in the GUI after making any changes in the CLI.
 

Philip Robar

Member
Joined
Jun 10, 2014
Messages
104
A note for people not familiar with FreeBSD and UNIX in general. The new swap partition that is created following the steps in this guide goes unused until it's enabled—FreeBSD doesn't automagically find and use swap space. You can verify this via the swapctl(8) command:

swapctl -l

which will list all of the active swap devices.

In fact, prior to 9.3 to permanently enable the new swap space you have to know how to mount the root partition as writeable and add the appropriate entry to /etc/fstab and then reboot before the new swap space would be used. In 9.3 and 9.10 you still need to edit /etc/fstab and reboot. (See swapon(8) if you want to use the new swap space immediately, but don't want to reboot until later.)

If you don't care about drive ids or more swap space you can just attach the new drive to the exiting pool using the dev ID, skipping all of the low level FreeBSD commands. If you want to use GTPIDs but don't care about adding more swap then use gpart(8) to create a new partition scheme with a single partition and then attach that partition using its GPTID to the pool.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
A note for people not familiar with FreeBSD and UNIX in general. The new swap partition that is created following the steps in this guide goes unused until it's enabled—FreeBSD doesn't automagically find and use swap space. You can verify this via the swapctl(8) command:

swapctl -l

which will list all of the active swap devices.

In fact, prior to 9.3 to permanently enable the new swap space you have to know how to mount the root partition as writeable and add the appropriate entry to /etc/fstab and then reboot before the new swap space would be used. In 9.3 and 9.10 you still need to edit /etc/fstab and reboot. (See swapon(8) if you want to use the new swap space immediately, but don't want to reboot until later.)

If you don't care about drive ids or more swap space you can just attach the new drive to the exiting pool using the dev ID, skipping all of the low level FreeBSD commands. If you want to use GTPIDs but don't care about adding more swap then use gpart(8) to create a new partition scheme with a single partition and then attach that partition using its GPTID to the pool.
This information is not correct for FreeNAS. FreeNAS automatically creates the swap space on zpool creation/expansion (unless changed from the default) and will automatically find and use such swapspace with no action from the end user.
 

Philip Robar

Member
Joined
Jun 10, 2014
Messages
104
This information is not correct for FreeNAS. FreeNAS automatically creates the swap space on zpool creation/expansion (unless changed from the default) and will automatically find and use such swapspace with no action from the end user.
Only if using the GUI, and you can't turn a single drive VDEV into a mirror via the GUI in FreeNAS 9.x—which is the whole point of this thread. As I said, "following the steps in this guide", which walks you through manually configuring a drive via the shell—not the GUI. The OS doesn't scan every drive looking for swap devices to use. If a swap device is not enabled via running swapon(8) or an entry read from /etc/fstab at boot time it isn't used.
 
Top