As requested by a senior member of the forum a guide on how to fix GPT Table:
1. Backup all your data from the partition you will be fixing the GPT from, I know it can be a pain, but I do not know how to do that without destroying the partition. For those using mirror raid it should not be a problem if only 1 disks has got GPT corrupt, as it will start rebuilding once added back to the pool.
2. I had to destroy the pool as all the drives had GPT corrupt!
3a. In SSH:
Code: Select all
zpool destroy -f "name of your pool"
for example:
Code: Select all
gpart destroy -F gpt "name of the disk where gpt will be destroyed"
3b. In my case all 4 partitions, so:
Code: Select all
gpart destroy -F gpt ada0
gpart destroy -F gpt ada1
gpart destroy -F gpt ada3
gpart destroy -F gpt ada4
4. Now you need to recreate GPT:
Code: Select all
gpart create -s gpt ada0
gpart create -s gpt ada1
gpart create -s gpt ada3
gpart create -s gpt ada4
5. I also prefer having 4kb sectors so:
Code: Select all
gnop create -S 4096 ada0
gnop create -S 4096 ada1
gnop create -S 4096 ada3
gnop create -S 4096 ada4
6. Re-create pool:
Code: Select all
zpool create -fm /mnt/ZFS_RAID ZFS_RAID mirror /dev/ada0.nop /dev/ada1.nop mirror /dev/ada3.nop /dev/ada4.nop
7. Check if the pool has been created with 4kb sectors by:
if it is 12 then you have got 4kb sectors if it is 9 something has gone wrong.
8. For those who has only got 1 disk with GPT corrupt, you just need to detach device from the pool by in my example lets say the pool is a mirror pool with ada0.nop and ada1.nop, where ada0.nop GPT is corrupt:
Code: Select all
zpool detach ZFS_RAID /dev/ada0.nop
then you go to 3b and follow the instruction to 5 where you:
Code: Select all
zpool attach ZFS_RAID /dev/ada0.nop
Hope it will help.