硬盘写入时报错,查看磁盘信息有如下错误:
sudo fdisk -l
The backup GPT table is corrupt, but the primary appears OK, so that will be used.
Disk /dev/sda: 2.7 TiB, 3000592982016 bytes, 5860533168 sectors
Disk model: nal USB 3.0
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 97D73452-E797-4781-82D2-6946D2B1AC81
Device Start End Sectors Size Type
/dev/sda1 2048 5860532223 5860530176 2.7T Linux filesystem
使用gdisk解决
sudo gdisk /dev/sda
输出
GPT fdisk (gdisk) version 1.0.3
Caution: invalid backup GPT header, but valid main header; regenerating
backup header from main header.
Warning! Main and backup partition tables differ! Use the 'c' and 'e' options
on the recovery & transformation menu to examine the two tables.
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.
****************************************************************************
Command (? for help):
依次输入 r、b、w、y
解释:
r : recovery and transformation options (experts only)
b : use backup GPT header (rebuilding main)
w : write table to disk and exit
y : yes
Command (? for help): r
Recovery/transformation command (? for help): b
Recovery/transformation command (? for help): w
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.
再次查看磁盘信息,已恢复正常
sudo fdisk -l
Disk /dev/sda: 2.7 TiB, 3000592982016 bytes, 5860533168 sectors
Disk model: nal USB 3.0
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 97D73452-E797-4781-82D2-6946D2B1AC81
Device Start End Sectors Size Type
/dev/sda1 2048 5860532223 5860530176 2.7T Linux filesystem