FreeNAS ZFS pool fixup

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

whitey

Moderator
Jun 30, 2014
2,766
868
113
41
Have a buddy who had a disk go haywire and I don't think he executed the proper commands to re-attach to mirror.

Here is how pool stands now.

pool: hgst2tb
state: ONLINE
scan: resilvered 87.6G in 0h31m with 0 errors on Thu Jul 14 07:56:32 2016
config:

NAME STATE READ WRITE CKSUM
hgst2tb ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
gptid/b539d48e-9af3-11e5-8303-00151776e716 ONLINE 0 0 0
gptid/b79dba25-9af3-11e5-8303-00151776e716 ONLINE 0 0 0
mirror-1 ONLINE 0 0 0
gptid/2e62a9d0-9af9-11e5-8303-00151776e716 ONLINE 0 0 0
gptid/30e35d1e-9af9-11e5-8303-00151776e716 ONLINE 0 0 0
gptid/fdfc936c-9af9-11e5-8303-00151776e716 ONLINE 0 0 0
mirror-3 ONLINE 0 0 0
gptid/68925b45-9afc-11e5-8303-00151776e716 ONLINE 0 0 0
gptid/6aef861c-9afc-11e5-8303-00151776e716 ONLINE 0 0 0
mirror-4 ONLINE 0 0 0
gptid/378b21a4-9afe-11e5-8303-00151776e716 ONLINE 0 0 0
gptid/3a122d97-9afe-11e5-8303-00151776e716 ONLINE 0 0 0
logs
gptid/ff515b69-33d4-11e6-91ec-00151776e716 ONLINE 0 0 0
cache
gptid/ef73d917-33d4-11e6-91ec-00151776e716 ONLINE 0 0 0

errors: No known data errors


I can see in history he ran this.

zpool online hgst2tb gptid/006cbf5d-9afa-11e5-8303-00151776e716

What is the proper way to fix this up now and get mirror-2 online agian w/out nuking pool?

Any ideas are greatly appreciated.

EDIT: Seems like gpart/glabel/camcontrol/smartctl/sas2ircu are your friends. Putting the puzzle back together is the REAL magic!
 
Last edited:
  • Like
Reactions: MiniKnight

whitey

Moderator
Jun 30, 2014
2,766
868
113
41
Furthermore is there a graceful was using GUI to replace a failed disk in FreeNAS that is configured in stripped/mirror config, so far I am NOT seeing it?
 

ttabbal

Active Member
Mar 10, 2016
747
207
43
47
Not sure. I know my preferred method (add a disk, wait for resliver, remove the old) irritated the Freenas forum guys as it's not possible via the GUI. It's stupid simple on CLI.

I think you are supposed to select that you want to replace, pick the drive to be replaced, then pick the new one. I don't think it's different for mirrors, but I only played with it on raidz2.
 

whitey

Moderator
Jun 30, 2014
2,766
868
113
41
Not sure. I know my preferred method (add a disk, wait for resliver, remove the old) irritated the Freenas forum guys as it's not possible via the GUI. It's stupid simple on CLI.

I think you are supposed to select that you want to replace, pick the drive to be replaced, then pick the new one. I don't think it's different for mirrors, but I only played with it on raidz2.
@ttabbal, is this the process/sequence you use?

zpool offline STORE1 /dev/gptid/b03def73-6ac9-11e2-a0b8-50465db1a7ad
zpool replace STORE1 /dev/gptid/b03def73-6ac9-11e2-a0b8-50465db1a7ad /dev/da0
WAIT for resilver to complete

or

zpool replace vol0 16887281796856902055 /dev/da0 (or, whatever its label is)
WAIT for resilver to complete
zpool detach vol0 16887281796856902055

I've seen it listed both ways, assuming the second option is if you have spare slots in chassis but that's just my guess.
 

ttabbal

Active Member
Mar 10, 2016
747
207
43
47
Generally, I have spare slots or just set the drive somewhere I can reach a cable to. My process for mirrors is something like this..

zpool attach vol0 /dev/<newDrive>
WAIT
zpool detach vol0 /dev/<badDrive>

Generally, I'm replacing based on SMART errors, not a completely bad drive. So this way is faster, and maintains whatever redundancy is available if the "bad" drive still responds. Most of the time, I start getting errors in SMART that scrubs don't see, so data is not yet compromised.
 
  • Like
Reactions: MiniKnight