2

My recently installed ubuntu 16.04 system is not behaving correctly (does not boot). I did check the status of the hard drives using fdisk and I discovered that somehow the backup GPT table is corrupt.

ubuntu@ubuntu:~$ sudo fdisk -lu /dev/sda
The backup GPT table is corrupt, but the primary appears OK, so that will be used.
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 574A30DA-2F2E-414A-A537-2E3E2B4F46FA

Device         Start       End   Sectors   Size Type
/dev/sda1       4096 611463167 611459072 291.6G Linux filesystem
/dev/sda2  611463168 955576319 344113152 164.1G Linux filesystem
/dev/sda3  955578368 975628335  20049968   9.6G Linux swap
/dev/sda4  975630336 976773119   1142784   558M EFI System

I was able to fix this by using gdisk:

ubuntu@ubuntu:~$ sudo gdisk /dev/sda
GPT fdisk (gdisk) version 1.0.1

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

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): p
Disk /dev/sda: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 574A30DA-2F2E-414A-A537-2E3E2B4F46FA
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 2048-sector boundaries
Total free space is 8125 sectors (4.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            4096       611463167   291.6 GiB   8300  
   2       611463168       955576319   164.1 GiB   8300  
   3       955578368       975628335   9.6 GiB     8200  
   4       975630336       976773119   558.0 MiB   EF00  EFI System Partition

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/sda.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe(8) or kpartx(8)
The operation has completed successfully.

After using partprobe fdisk seems happy:

ubuntu@ubuntu:~$ sudo fdisk -lu /dev/sda
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 574A30DA-2F2E-414A-A537-2E3E2B4F46FA

Device         Start       End   Sectors   Size Type
/dev/sda1       4096 611463167 611459072 291.6G Linux filesystem
/dev/sda2  611463168 955576319 344113152 164.1G Linux filesystem
/dev/sda3  955578368 975628335  20049968   9.6G Linux swap
/dev/sda4  975630336 976773119   1142784   558M EFI System

However if I reboot the hd seems to revert to the old state and the problem persist. What could cause this? What else should I check?

Edit: I used bootinfo to get more information: http://paste2.org/VjgDdhO3 It does report something strange for the boot/efi partition:

Boot sector info:  According to the info in the boot sector, sda4 starts at sector 0. But according to the info from fdisk, 
sda4 starts at sector 975630336.
  • 1
    Could you please run Boot-Info and edit your question to include a link to its resulting info log? Thanks. – David Foerster Oct 4 '16 at 19:23
  • Hi @DavidFoerster. I attached the output from boot-info. Thanks! – igon Oct 4 '16 at 20:15
  • I don't actually know much about EFI/GPT booting but I know that the boot info log would help those who do. – David Foerster Oct 4 '16 at 20:19
  • I have the same problem, with a secondary 3Tb disk. It cannot format it in such a way that I can use the whole extent of it, since the GPT table gets corrupted at every reboot. Some sites say that the kernel might not be updated, some others say that MBR is not necessary in this case. I'm quite new to this problems – 3nrique0 May 22 '17 at 13:32
  • The boot sector info you can ignore: FAT and NTFS boot sectors contain the starting offset of the partition because the Microsoft boot code is too dumb to use the partition table to get it, and instead uses the copy in the partition boot sector. If Windows isn't booting from the partition, that field is not used. Linux fat format tools just leave it as zero. What does parted have to say about this partition table? – psusi Jun 11 '17 at 2:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.