Mounting a VMFS5 volume fails with the error: Read from primary gpt table failed
search cancel

Mounting a VMFS5 volume fails with the error: Read from primary gpt table failed

book

Article ID: 341569

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

 
 
 


Symptoms:
  • A VMFS5 volume fails to mount.

  • In the /var/log/vmkernel.log, you see entries similar to:

    cpu12:23535238)Partition: 644: Read from primary gpt table failed on "naa.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".
    cpu12:23535238)FSS: 5092: No FS driver claimed device 'naa.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:1': Not supported
  • When trying to read the GTP table info using the partedUtil command, you see this error:

    Error: The primary GPT table is corrupt, but the backup appears OK, so that will be used. Fix primary table ? diskPath (/dev/disks/naa.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) diskSize (xxxxxxxxx) AlternateLBA (1) LastUsableLBA (xxxxxxxxxxx)


Environment

VMware vSphere ESXi 6.x
VMware vSphere ESXi 7.x
VMware vSphere ESXi 8.x

Cause

This issue occurs if the primary GPT table is corrupted.

Resolution

To resolve this issue, use the partedUtil utility to recover the primary GTP table from the secondary GPT table, using the fixGpt option:

  1. If the volume is still mounted on an ESXi host, identify the device ID mapped to by a given datastore name by using this command:

    esxcfg-scsidevs -m

    You see output similar to:

    naa.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:1 /vmfs/devices/disks/naa.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:1 yyyyyyyy-yyyyyyyy-yyyy-yyyyyyyyyyyy 0 DATASTORE_NAME

    where
    DATASTORE_NAME is the name of the datastore.

    For more information, see Identifying disks when working with VMware ESXi

  2. Confirm that the device has a corrupted GTP table by using this command:

    partedUtil getptbl /vmfs/devices/disks/naa.ID

    Where naa.ID is the naa ID of the partition to evaluate, reported in the /var/log/vmkernel.log file.

    For Example (using the partition identified in step 1):

    # partedUtil getptbl /vmfs/devices/disks/naa.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    Error: The primary GPT table is corrupt, but the backup appears OK, so that will be used. Fix primary table ? diskPath (/dev/disks/naa.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) diskSize (4294967296) AlternateLBA (1) LastUsableLBA (4294967262)
    gpt
    267349 255 63 4294967296
    1 2048 4294967262 AA31E02A400F11DB9590000C2911D1B8 vmfs 0


  3. To fix the partition table, ensure the datastore is not a Raw Device Mapping (see Note), and then run this command:

    partedUtil fixGpt /vmfs/devices/disks/naa.ID

    Wherenaa.ID is the naa ID of the partition to fix, reported in the /var/log/vmkernel.log file.

    For Example (using the partition identified in step 1):

    # partedUtil fixGpt /vmfs/devices/disks/naa.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    Note: Ensure the device is not a Raw Device Mapping, and answer "Y" when you get this message:XXXXX

    FixGpt tries to fix any problems detected in GPT table.
    Please ensure that you don't run this on any RDM (Raw Device Mapping) disk.
    Are you sure you want to continue (Y/N): Y
    gpt
    267349 255 63 4294967296
    1 2048 4294967262 AA31E02A400F11DB9590000C2911D1B8 vmfs 0

  4. Rescan the VMFS volumes by running this command:

    vmkfstools -V


Additional Information

To manually recreate a partition entry on a datastore, see Using partedUtil command line disk partitioning utility on ESXi.
Identifying disks when working with VMware ESXi
Using partedUtil command line disk partitioning utility on ESXi

Impact/Risks:
Warning:
This procedure can change the partition table. It should only be used if a valid current backup of the data residing on the datastore exists.