I have a Ubuntu box on an SSD and a secondary HDD (/dev/sdb) with some NTFS partitions.

Some context: yesterday the machine was unresponsive and I had to forcefully shut it down (cut power). On reboot Ubuntu would drop to Emergency mode. I found out that the HDD's UUID had vanished (did not show up in blkid), thus rendering /etc/fstab corrupt . I commented out the disk's line on fstab and managed to boot Ubuntu.

Now I am trying to mount the HDD again. First I tried Gparted. This is the output from libparted (used by gparted):

libparted : 3.2
end of file while reading /dev/sdb
The primary GPT table is corrupt, but the backup appears OK, so that will be used.

Interestingly, sudo blkid shows /dev/sdb as having a PTUUID instead of UUID:

$ sudo blkid
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/loop2: TYPE="squashfs"
/dev/sda1: UUID="e407bc1c-4c2d-4dae-80ce-e6bd96346698" TYPE="ext4" PARTUUID="659e6a1e-01"
/dev/sda5: UUID="f9500440-cddf-41f6-8512-5a30e66fbf3d" TYPE="swap" PARTUUID="659e6a1e-05"
/dev/sda6: UUID="18abc384-a610-4f65-8430-0109548a89ef" TYPE="ext4" PARTUUID="659e6a1e-06"
/dev/sdb: PTUUID="a6e9090d-b5ab-412a-8568-2eee08fa3fa8" PTTYPE="gpt"

I am confident that the partitions are still there, I just can't mount them. parted lists them correctly:

$ sudo parted
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) select /dev/sdb                                                  
Using /dev/sdb
(parted) p                                                                
Error: end of file while reading /dev/sdb
Retry/Ignore/Cancel? i                                                    
Error: The primary GPT table is corrupt, but the backup appears OK, so that will be used.
OK/Cancel? OK                                                             
Model: ATA ST1000LM024 HN-M (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name                          Flags
 1      1049kB  316MB   315MB                EFI system partition          boot, esp
 2      316MB   945MB   629MB   ntfs         Basic data partition          hidden, diag
 3      945MB   1079MB  134MB                Microsoft reserved partition  msftres
 4      1079MB  979GB   978GB   ntfs         Basic data partition          msftdata
 5      979GB   1000GB  21,5GB  ntfs         Basic data partition          hidden, diag

(parted) q

So there are 2 errors (Error: end of file while reading /dev/sdb,Error: The primary GPT table is corrupt, but the backup appears OK, so that will be used.) which are likely rendering the partition unmountable. Any ideas how to solve them?

EDIT This is the output of ntfsfix:

$ sudo ntfsfix /dev/sdb
Mounting volume... NTFS signature is missing.
Attempting to correct errors... NTFS signature is missing.
Failed to startup volume: Invalid argument
NTFS signature is missing.
Trying the alternate boot sector
Unrecoverable error
Volume is corrupt. You should run chkdsk.

EDIT Output of gdisk

GPT fdisk (gdisk) version 1.0.1

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

Caution! After loading partitions, the CRC doesn't check out!
Warning! Main partition table CRC mismatch! Loaded backup partition table
instead of main partition table!

Warning! One or more CRCs don't match. You should repair the disk!

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.

EDIT This is the command I wrongly executed which caused the trouble: sudo dd if=/dev/zero of=/dev/sdb bs=512 seek=1

  • Try installing gdisk sudo apt install gdisk, then see if you can't repair it by running sudo gdisk /dev/sdb. And when you can read the disk / partitions successfully, make sure you press w to write. – Terrance May 27 '17 at 15:06
  • @Terrance I pasted the output of gdisk. Won't writing wipe out the data in the existing partitions? Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!! – brito May 27 '17 at 15:09
  • When you did the sudo parted you actually recovered the backup GPT partition, but you didn't press w before you quit so it would write the backup as the primary. – Terrance May 27 '17 at 15:11
  • Yeah, I remember I was uncertain I should use w because of the same warning message which lead me to believe I would lose data. – brito May 27 '17 at 15:12
  • Well, when the primary is damaged you don't have a choice but to overwrite it with the backup that is working. – Terrance May 27 '17 at 15:13
up vote 5 down vote accepted

TLDR: I was able to restore the disk (with data) by writing with gdisk (w command).

As was discussed in the question and comment section, this is the scenario: I had accidentally destroyed the GPT header of the disk by issuing a dd with 0s on /dev/sdb.

I ran gdisk(8) on the disk, which informed that the GPT header was corrupt, but the backup was fine and loaded the backup. In the gdisk CLI, I ran a w command (which writes the partition table information to disk) and exited. After that, /dev/sdb was instantly recognized and mounted by Ubuntu, and no other changes were necessary.

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.