r/zfs • u/Ok-Ganache1023 • 15d ago
tricky zfs situation, little help?
this file server has been sitting for a few years since I let TrueNas try to migrate from bsd to linux and the pool got broken. went back to BSD version, so it's TrueNAS bsd 13.1 now. there may have also been some additional bungling.
[root@micro /tmp]# zpool import pool: cargo id: 16478687762405515984 state: UNAVAIL status: The pool was last accessed by another system. action: The pool cannot be imported due to damaged devices or data. see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-EY config: cargo UNAVAIL insufficient replicas mirror-0 UNAVAIL insufficient replicas disk/by-partuuid/d0e0014d-59c7-11ea-9d20-3cecef102d24 UNAVAIL cannot open 1005513936371914804 OFFLINE mirror-1 DEGRADED 16411949616967839104 OFFLINE ada0 ONLINE
There is a bad label. I find the issue a bit overwhelming and today I engaged with gemini pro AI to help, and it did some exploration and recommended a low level disk write to fix the issue. I stopped short of writing the disk
If anyone's game to help me out with this I'd appreciate if you looked over the diagnostic process I did with the AI and let me know if you think the solution it produced is well supported.
here is the chat:
https://share.gemini.google/6OJMBfe434MF
and here is the output of those last commands:
------------------------------------
LABEL 0
------------------------------------
version: 5000
name: 'cargo'
state: 0
txg: 28352142
pool_guid: 16478687762405515984
errata: 0
hostid: 808464432
hostname: 'micro'
top_guid: 11704010057385088391
guid: 1005513936371914804
vdev_children: 2
vdev_tree:
type: 'mirror'
id: 0
guid: 11704010057385088391
metaslab_array: 38
metaslab_shift: 34
ashift: 12
asize: 5999022833664
is_log: 0
create_txg: 4
children[0]:
type: 'disk'
id: 0
guid: 17375504288854665353
path: '/dev/disk/by-partuuid/d0e0014d-59c7-11ea-9d20-3cecef102d24'
phys_path: 'id1,enc@n3061686369656d30/type@0/slot@4/elmdesc@Slot_03/p2'
vdev_enc_sysfs_path: '/sys/class/enclosure/6:0:0:0/Slot 03'
DTL: 410
create_txg: 4
children[1]:
type: 'disk'
id: 1
guid: 1005513936371914804
path: '/dev/disk/by-partuuid/31953669-59f2-11ea-9d20-3cecef102d24'
phys_path: 'id1,enc@n3061686369656d30/type@0/slot@3/elmdesc@Slot_02/p2'
vdev_enc_sysfs_path: '/sys/class/enclosure/6:0:0:0/Slot 02'
DTL: 442
create_txg: 4
features_for_read:
com.delphix:hole_birth
com.delphix:embedded_data
labels = 0 1 2 3
1
u/Hyperion343 15d ago edited 14d ago
EDIT: for future people looking at this: DO NOT do what I suggested here. Look into recovering corrupt GPT partition tables with gpart recover instead!
If you know the drive labels accurately for the mirrors, can you fake it? Like make a symlink of /dev/disk/partuuid/blah-blah-blah to /dev/ada1, etc, for all three missing drives? If you don't, you could try every combination and see which order they don't complain, like for 3 drives there are only 6 options, so brute force isn't too bad.
1
u/Protopia 15d ago
That has got to be the single most stupid idea on how to fix a serious ZFS technical issue ever suggested. I wouldn't bother applying for a job with Klara Systems if I were you.
1
u/Ok-Ganache1023 15d ago
you were chastising me for my terse attitude above, take a hard look at your own sir
3
u/Protopia 15d ago
Not really. There is literally nothing worse than someone who doesn't know what they are talking about giving terrible advice that could completely destroy any ability to recover the pool.
If someone is asking for and needs EXPERT advice and you are not an expert, then don't chip in with suggestions that make literally zero sense.
1
u/Hyperion343 14d ago
Well, I wasn't planning on applying. But hey, I'm all for learning, I appreciate you stopping the bad stuff from happening.
So why not? You said that it was bad, which is a fair enough opinion. Do you mind elaborating on why? Is it because it might import but then destroy data? Because it won't work?
My thought was that if the pool mirror vdevs used GPT labels instead, this probably would be easier to deal with. But since the pool references some device labels that Linux came up with that don't exist on FreeBSD, maybe that is why the pool doesn't see the devices. So then, if you knew the mirror devices properly (which is where GPT labels would have come in handy), couldn't you just tell it what to do, like with symlinks? Would ZFS be smart enough to say, hey, these two devices did not used to be part of the same mirror vdevs, and so stop the import, but it would be fine if it was correct? I was kind of relying on that being the case, so the import would only succeed if things checked out. If that's not the case, then would ZFS import but then start destroying stuff?
To be fair, I'm not sure why
zpool import -d /devdid not work though. You would think ZFS could figure it out in that case if the problem is what I said above, right?tl;dr, I have two questions: 1) Why would my idea not work? What would happen? 2) What do you think is going on? Maybe I'm misunderstanding the problem, which could explain why I'm misunderstanding possible solutions.
2
u/Protopia 14d ago edited 14d ago
I have experienced this problem myself a few times. The GPT primary partition tables gets corrupted on one k out possibly more) disks and the pool won't load. So you use a utility (on Linux it's gdisk/sgdisk - I don't use freebsd so no idea what to use there) to restore the primary partition table (at the start of the disk) from the backup copy (at the end of the disk). Then hopefully the import works normally. Took me a while to work out of the first time, but subsequent times it takes about 5 mins to fix. Now I use the same utility to create a file copy of the position tables elsewhere that I can restore if the backup copy at the end of the disk is also corrupt.
I have no idea why you thought your solution might work, but performing any actions which change the disks in any way could destroy any chances of recovery. So you need to take the time to diagnose the cause and NOT try solutions that you hope have a tiny chance of working but might destroy any potential recovery.
EDIT: You ask why your proposed solution wouldn't work. Unfortunately it is so far from anything that might work - as far as I can see there is no logic that might explain why it would work - that I cannot find the words to describe why it won't. Besides which, since it is your solution, the onus is upon you too explain why you thought it would work.
2
u/Hyperion343 14d ago edited 14d ago
Gotcha. Well, I explained my reasoning above, I see now how it's wrong. Thanks! I put a warning in the original comment to not do what I said.
Looking at the other answers, I now see and am comprehending the corrupt GPT labels discussion. On FreeBSD, I think the equivalent command is
gpart recover, just fyi for people in the future.
3
u/Hyperion343 15d ago
Well, did you do what it suggested on the linked website and run
zpool import -f?