Solved The primary GPT table is corrupt or invalid

I found only old threads with this problem. The suggested solution is to use gpart recover, the problem is geom is not recognizing the ada1 device.
sudo gpart list /dev/ada1
Code:
gpart: No such geom: /dev/ada1

I looked at SMART and tried scrubbing zbackup - everything looks OK.

Here is additional information:
Code:
gada1 at ahcich1 bus 0 scbus4 target 0 lun 0
ada1: <ST31000528AS CC38> ATA-8 SATA 2.x device
ada1: Serial Number 5VP2ZAGT
ada1: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 8192bytes)
ada1: Command Queueing enabled
ada1: 953869MB (1953525168 512 byte sectors: 16H 63S/T 16383C)
ada1: Previously was known as ad6
GEOM: ada1: the primary GPT table is corrupt or invalid.
GEOM: ada1: using the secondary instead -- recovery strongly advised.
zdb
Code:
zbackup:
  version: 5000
  name: 'zbackup'
  state: 0
  txg: 4
  pool_guid: 12108379260595416263
  hostid: 619165299
  hostname: 'darkstar'
  vdev_children: 1
  vdev_tree:
  type: 'root'
  id: 0
  guid: 12108379260595416263
  create_txg: 4
  children[0]:
  type: 'disk'
  id: 0
  guid: 3042244348290888489
  path: '/dev/ada1'
  phys_path: '/dev/ada1'
  whole_disk: 1
  metaslab_array: 33
  metaslab_shift: 33
  ashift: 9
  asize: 1000199946240
  is_log: 0
  create_txg: 4
  features_for_read:
 
Last edited by a moderator:
This error typically happens when a GPT disk is repartitioned in a non-GPT format (usually MBR), but the old GPT tables are not removed first. This might also happen if a GPT disk is reformatted with ZFS. The secondary GPT table at the end of the disk is not overwritten because ZFS does not use the last part of a disk. That appears to be the situation here. If the last 34 blocks of the disk are not used by ZFS, overwriting them with zeros would clear the error. Do not attempt that without both a full backup and verification that it really is the problem.
 
Back
Top