ZFS stores 4 labels, 2 at the beginning of a device, 2 at the end. When they are corrupted a pool cannot be mounted.
I had a case of 3 broken labels (failed to unpack
), but 1 was still intact. I could list it with zdb -lu
just fine.
zpool import -d /dev/sda
failed. Using -f
, and/or -F
, and/or -D
failed.
cannot import '/dev/sda': no such pool available
Is there any way I could copy the label #2 to the labels #0, #1, #3?
I am assuming they are redundant copies, existing to boost reliability. However, if that were true, I fail to understand why zfs wouldn't import a pool if there's at least one label left intact, and then simply restore the other three.
Background on how it came to this issue:
- I did the stupid thing and created two of my pools with device names such as /dev/sda instead of /dev/disk/by-uuid/1234. Honestly I don't knwo what I was thinking, because I've been there before
- Today I plugged in a new drive, wanting to create a new, bigger pool.
- Of course, the two pools that failed were those whose "sda" names shifted by one letter.
- Once I realized this, I rebooted without the new drive, imported just fine with the correct device names used inside the label.
Why was this reported as a label issue? The labels are still broken, even after the import, with only label 2 intact. How can I fix them?
Add-on question: Is there a tool such as zpool note-my-device-has-a-new-name /dev/sda /dev/disk/by-uuid/1234
? Considering the amount of people having the issue, this seems to be helpful. Once I've got my backup of those pools updated, I'll try again.