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

parted(8) Error: The backup GPT table is corrupt, but the primary appears OK, so that will be used.



debian-users:

My daily driver:

2020-09-10 16:17:14 root@tinkywinky ~
# cat /etc/debian_version ; uname -a
9.13
Linux tinkywinky 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64 GNU/Linux


parted(8) was complaining about the backup GPT table on a 300 GB external disk used to store images of system drives:

2020-09-10 14:01:58 root@tinkywinky ~
# parted /dev/disk/by-id/ata-ST3300622AS_******** unit s print free
Error: The backup GPT table is corrupt, but the primary appears OK, so that will be used.
OK/Cancel? ok
Model: ATA ST3300622AS (scsi)
Disk /dev/sdb: 586072368s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start       End         Size        File system  Name      Flags
	34s         2047s       2014s       Free Space
 1      2048s       586072063s  586070016s  ext2         ********
	586072064s  586072334s  271s        Free Space


Use sfdisk(8) to dump the disk layout:

2020-09-10 14:16:31 root@tinkywinky ~/hardware/seagate/ST3300622AS/********
# sfdisk --dump /dev/disk/by-id/ata-ST3300622AS_******** > sfdisk-20200910-1417.dump The backup GPT table is corrupt, but the primary appears OK, so that will be used.

2020-09-10 14:18:48 root@tinkywinky ~/hardware/seagate/ST3300622AS/********
# cat sfdisk-20200910-1417.dump
label: gpt
label-id: 65C1B6E8-DDF7-40E0-9734-63AC97E5DBC8
device: /dev/disk/by-id/ata-ST3300622AS_********
nit: sectors
first-lba: 34
last-lba: 586072334

/dev/disk/by-id/ata-ST3300622AS_********-part1 : start= 2048, size= 586070016, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=D96D1D49-5514-4B24-ACCD-008CC9D3B15F, name="********"


Verify filesystem contents are already on server:

2020-09-10 14:22:02 root@tinkywinky ~
# mount /mnt/image

2020-09-10 14:32:01 root@tinkywinky ~
# rsync -n -rac --stats --progress /mnt/image/ f3:/var/local/image/
sending incremental file list

Number of files: 99 (reg: 90, dir: 9)
Number of created files: 0
Number of deleted files: 0
Number of regular files transferred: 0
Total file size: 218,382,930,266 bytes
Total transferred file size: 0 bytes
Literal data: 0 bytes
Matched data: 0 bytes
File list size: 0
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 6,599
Total bytes received: 20

sent 6,599 bytes  received 20 bytes  1.27 bytes/sec
total size is 218,382,930,266  speedup is 32,993,341.93 (DRY RUN)

2020-09-10 16:08:21 root@tinkywinky ~
# umount /mnt/image


Restore the disk layout:

2020-09-10 16:08:30 root@tinkywinky ~/hardware/seagate/ST3300622AS/********
# sfdisk /dev/disk/by-id/ata-ST3300622AS_******** < sfdisk-20200910-1417.dump The backup GPT table is corrupt, but the primary appears OK, so that will be used.
Checking that no-one is using this disk right now ... OK

Disk /dev/disk/by-id/ata-ST3300622AS_********: 279.5 GiB, 300069052416 bytes, 586072368 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: 65C1B6E8-DDF7-40E0-9734-63AC97E5DBC8

Old situation:

Device Start End Sectors Size Type /dev/disk/by-id/ata-ST3300622AS_********-part1 2048 586072063 586070016 279.5G Linux filesystem

>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Created a new GPT disklabel (GUID: 65C1B6E8-DDF7-40E0-9734-63AC97E5DBC8). /dev/disk/by-id/ata-ST3300622AS_********-part1: Created a new partition 1 of type 'Linux filesystem' and of size 279.5 GiB.
Partition #1 contains a ext2 signature.
/dev/disk/by-id/ata-ST3300622AS_********-part2: Done.

New situation:

Device Start End Sectors Size Type /dev/disk/by-id/ata-ST3300622AS_********-part1 2048 586072063 586070016 279.5G Linux filesystem

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.


Verify backup GPT table is fixed:

2020-09-10 16:10:02 root@tinkywinky ~/hardware/seagate/ST3300622AS/********
# parted /dev/disk/by-id/ata-ST3300622AS_******** u s p free
Model: ATA ST3300622AS (scsi)
Disk /dev/sdb: 586072368s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start       End         Size        File system  Name      Flags
	34s         2047s       2014s       Free Space
 1      2048s       586072063s  586070016s  ext2         ********
	586072064s  586072334s  271s        Free Space


Verify filesystem contents:

2020-09-10 16:17:22 root@tinkywinky ~
# mount /mnt/image

2020-09-10 16:30:14 root@tinkywinky ~
# rsync -n -ra --stats /mnt/image/ f3:/var/local/image/

Number of files: 99 (reg: 90, dir: 9)
Number of created files: 0
Number of deleted files: 0
Number of regular files transferred: 0
Total file size: 218,382,930,266 bytes
Total transferred file size: 0 bytes
Literal data: 0 bytes
Matched data: 0 bytes
File list size: 0
File list generation time: 0.164 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 5,159
Total bytes received: 20

sent 5,159 bytes  received 20 bytes  3,452.67 bytes/sec
total size is 218,382,930,266  speedup is 42,167,007.20 (DRY RUN)

2020-09-10 16:30:47 root@tinkywinky ~
# umount /mnt/image


David


Reply to: