[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: The backup GPT table is corrupt



On 8/12/25 01:22, mick.crane wrote:
The BIOS is like 12 years old.
The boot list option has UEFI checked


Okay.


Please check and post the Setup settings for the disk drive.


Please run and post:

# gdisk -l /dev/sda



The boot sequence has
debian
bookworm
UEFI Hard Drive
all checked.

the boot order is
1 Debian
2 Bookworm
3 UEFI Hard Drive

I don't know why there's so many entries. I may have changed the disk from MBR to GPT.
Likely after it was working I stopped messing with it.


I expect one of those ("Debian"?) corresponds to your current Debian installation and the other two are cruft from prior installations ("Bookworm" is old Debian, "UEFI Hard Drive" is for Windows?). Drill down into each of them and document their settings; notably, what file they point to in the EFI system partition. I have had to create these manually, so it is good to have some examples to refer to. See if you can selectively disable them, to figure out which one is current.


AIUI leaving the obsolete Setup boot entries is technically okay, but I would be inclined to remove them so that they cannot confuse me.


-------
root@courgette:/home/mick# gdisk /dev/sda
GPT fdisk (gdisk) version 1.0.9

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

Warning! One or more CRCs don't match. You should repair the disk!
Main header: OK
Backup header: ERROR
Main partition table: OK
Backup partition table: OK

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): v

No problems found. 2925 free sectors (1.4 MiB) available in 2
segments, the largest of which is 2014 (1007.0 KiB) in size.

Command (? for help): Command (? for help): r

Recovery/transformation command (? for help): ?
b    use backup GPT header (rebuilding main)
c    load backup partition table from disk (rebuilding main)
d    use main GPT header (rebuilding backup)
e    load main partition table from disk (rebuilding backup)
f    load MBR and build fresh GPT from it
g    convert GPT into MBR and exit
h    make hybrid MBR
i    show detailed information on a partition
l    load partition data from a backup file
m    return to main menu
o    print protective MBR data
p    print the partition table
q    quit without saving changes
t    transform BSD disklabel partition
v    verify disk
w    write table to disk and exit
x    extra functionality (experts only)
?    print this menu

Recovery/transformation command (? for help): d

Recovery/transformation 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.
root@courgette:/home/mick# reboot
root@courgette:/home/mick# gdisk /dev/sda
GPT fdisk (gdisk) version 1.0.9

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

Warning! One or more CRCs don't match. You should repair the disk!
Main header: OK
Backup header: ERROR
Main partition table: OK
Backup partition table: OK

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):

Repair seems to have failed.
Maybe it's to do with the entries in the boot order but now I'm nervous to change it.
mick


I do not see the problem with your gdisk(8) session -- it should have recomputed and wrote the secondary GPT (?).


Here is my console session from when I fixed the secondary GPT on a 300 GB SATA HDD:

2022-11-26 23:25:33 root@bullseye-bios ~/hardware/seagate/ST3300622AS/4NF2P9SV
# gdisk /dev/disk/by-id/ata-ST3300622AS_REDACTED
GPT fdisk (gdisk) version 1.0.6

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

Warning! One or more CRCs don't match. You should repair the disk!
Main header: OK
Backup header: ERROR
Main partition table: OK
Backup partition table: OK

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/disk/by-id/ata-ST3300622AS_REDACTED: 586072368 sectors, 279.5 GiB
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 14E024E6-6170-44C8-8F6E-A7E4F06498DC
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 586072334
Partitions will be aligned on 2048-sector boundaries
Total free space is 2285 sectors (1.1 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048       586072063   279.5 GiB   8300  image_luks

Command (? for help): v

No problems found. 2285 free sectors (1.1 MiB) available in 2
segments, the largest of which is 2014 (1007.0 KiB) in size.

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/disk/by-id/ata-ST3300622AS_REDACTED.
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.


David


Reply to: