Recovering a corrupt GPT Table

Status
Not open for further replies.

Sharon

Cadet
Joined
Jun 10, 2017
Messages
2
While rebooting my system I noticed the messages "the primary GPT table is corrupt or invalid." and "using the secondary instead" on a single drive in a RaidZ3 array.

I ran a smartctl extended test and that showed no errors and then scrubbed the pool - all the data is OK.

I offlined the drive referred to in the messages (using zpool offline) then used gpart to recover the primary GPT table and checked manually that it was correct.

I onlined the drive again. There was a very brief resilvering phase and at the end zpool status said all was ok. Then checked the GPT table and it was again corrupt. Another pool scrub showed no data errors.

I presume that the resilvering corrupted the GPT table again but don't know that for certain. What's the correct procedure for fixing a corrupt GPT table?
 
Last edited:

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
Please follow the forum rules and post your system specs and FreeNAS version so we can provide quick and precise help.

Also, include the error message in it's entirety.
 

Sharon

Cadet
Joined
Jun 10, 2017
Messages
2
I was not able to reproduce this issue on a Solaris ZFS system. On that system, GPT table modifications are not overwritten by a resilver, provided they don't modify the boundaries of the partition that contains the disk's ZFS volume.

That suggests that either Oracle fixed an issue or it was introduced in OpenZFS (or the platform specific FreeBSD implementation of OpenZFS) after the version 28 split from Solaris.

I've figured how to fix the GPT Table on FreeNAS. I'll write it up as a FreeBSD implementation issue although it's almost certainly a bug on all four OpenZFS source code bases.

Oh, and Joe, perhaps you need to work on your reading skills - I did quote the error messages :)
 

recki

Dabbler
Joined
Jul 27, 2016
Messages
21
Hi, this is not specific for a zpool.
Code:
gart recover "disk"
will repair the corrupt Partition table.

regards ré
 

wblock

Documentation Engineer
Joined
Nov 14, 2014
Messages
1,506
This sounds like you are telling ZFS to use the whole drive rather than a single GPT partition. That will understandably overwrite the primary GPT information, and possibly not bother the backup because it is at the very end of the drive and ZFS does not immediately need to write there.
 
Status
Not open for further replies.
Top