Repair corrupt GPT partition on graid mini disk

I'm trying to repair a GPT corrupt partition table on a graid mini 1TB external hard drive. Here is the report from gdisk:

root@philippe-desktop:/home/philippe/thomasdisk# gdisk /dev/sdb
GPT fdisk (gdisk) version 0.8.8

Caution: invalid main GPT header, but valid backup; regenerating main header
from backup!

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: damaged

****************************************************************************
Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
verification and recovery are STRONGLY recommended.
****************************************************************************

Command (? for help): ?
b   back up GPT data to a file
c   change a partition's name
d   delete a partition
i   show detailed information on a partition
l   list known partition types
n   add a new partition
o   create a new empty GUID partition table (GPT)
p   print the partition table
q   quit without saving changes
r   recovery and transformation options (experts only)
s   sort partitions
t   change a partition's type code
v   verify disk
w   write table to disk and exit
x   extra functionality (experts only)
?   print this menu

Command (? for help): v

No problems found. 262157 free sectors (128.0 MiB) available in 2
segments, the largest of which is 262151 (128.0 MiB) in size.

Command (? for help): p
Disk /dev/sdb: 1953546304 sectors, 931.5 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): FE2326A4-F411-489E-B0D9-D2D9EF21A00C
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 1953546270
Partitions will be aligned on 8-sector boundaries
Total free space is 262157 sectors (128.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  EFI System Partition
   2          409640      1953284119   931.2 GiB   AF00  G-RAID mini

Command (? for help):

It is my understanding that gdisk is automagically able to work around the corruption and that simply pressing w should repair my disk, but I'm unsure as usually the v (verify) option should propose revovery options to me.

Can I safely go and press w? I already did sgdisk -b backup.gpt /dev/sdb

p.s: please redirect me to the correct website if this question is offtopic


If you spend a few minutes reading your output above you'll find gdisk is telling you what to do (it found a problem: invalid main GPT header, but valid backup;, and took an action for you: regenerating main header from backup!. It's also making a recommendation: disk verification and recovery are STRONGLY recommended. -- you should probably follow the recommendation).


Based on the fact that verification didn't return any problems you're probably OK writing out the partition layout - my understanding is gdisk will use & write out the regenerated GPT data.

If you want to be explicit in your actions the recovery menu has an option to use the backup GPT header (rebuilding/replacing the main GPT header) which you can specifically invoke, and that would appear to be the correct action to take (provided the GPT layout you're seeing above looks sane - otherwise you might have to manually rebuild your partition layout).