我意外地运行了sgdisk -o /dev/sda
并sgdisk -O /dev/sda
删除了所有分区数据。
fdisk
我的计算机仍在运行,并且有和的输出lsblk
。我该如何使用这些信息尽可能地恢复到以前的状态?
磁盘管理
Disk /dev/sda: 238.5 GiB, 256060514304 bytes, 500118192 sectors
Disk model: SAMSUNG SSD 830
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: E19883E7-FC5D-4850-805A-CF22ABBC2074
Device Start End Sectors Size Type
/dev/sda1 4097 618497 614401 300M EFI System
/dev/sda2 618498 63533055 62914558 30G Linux filesystem
/dev/sda3 63533056 97087487 33554432 16G Linux swap
/dev/sda4 97087488 139030527 41943040 20G Linux filesystem
/dev/sda5 139030528 248078335 109047808 52G Linux filesystem
/dev/sda6 248078336 329732095 81653760 39G Linux filesystem
/dev/sda7 329732096 393066495 63334400 30.2G Linux filesystem
lsblk
NAME FSTYPE SIZE UUID PARTUUID MOUNTPOINT PARTTYPE
sda 256060514304
├─sda1 vfat 314573312 5123-3127 19e1fb7a-7221-426d-a26c-ff4f7f3de0cc /boot/efi c12a7328-f81f-11d2-ba4b-00a0c93ec93b
├─sda2 ext4 32212253696 5b9b0319-da3c-41b0-bd8f-117cfefb731b 2031b940-3903-324a-9e9d-296528b9ef50 /run/media/xxxxxx/5b9b0319-da3c-41b0-bd8f-117cfefb731b 0fc63daf-8483-4772-8e79-3d69d8477de4
├─sda3 swap 17179869184 b3ade29f-a36a-43ee-8394-d1306ec6fcb8 fe10d42d-948b-594e-bee5-bc113a9c5314 [SWAP] 0657fd6d-a4ab-43c4-84e5-0933c84b4f4f
├─sda4 ext4 21474836480 30dbddd8-d4ad-42b9-9fcc-da575eababc0 9e8ef543-2c98-484d-8edf-5e54600f29fe /run/media/xxxxxx/30dbddd8-d4ad-42b9-9fcc-da575eababc0 0fc63daf-8483-4772-8e79-3d69d8477de4
├─sda5 ext4 55832477696 5005fa04-406a-4ec8-891a-11a2d9058daf 500ff476-35de-436f-b829-e719989455da /run/media/xxxxxx/5005fa04-406a-4ec8-891a-11a2d9058daf 0fc63daf-8483-4772-8e79-3d69d8477de4
├─sda6 ext4 41806725120 8bcc5a7e-31f5-41fe-8a4c-093bd1e70a66 6fc10074-76bc-496c-8465-4ec87aa3cd60 /run/media/xxxxxx/8bcc5a7e-31f5-41fe-8a4c-093bd1e70a66 0fc63daf-8483-4772-8e79-3d69d8477de4
└─sda7 ext4 32427212800 0afbcdd0-4bc2-4322-9d6d-46b2cf68238e df5fe961-585d-48b9-9a60-4ffb32e73819 / 0fc63daf-8483-4772-8e79-3d69d8477de4
答案1
由于 sgdisk 手册在“-o”参数的文档中没有说明可能删除备份 GPT,因此您可以使用十六进制编辑器使用“EFI PART”搜索备份表。找到后,将其复制到磁盘上从第 2 个扇区开始的位置。当您的十六进制编辑器从扇区 0 开始时,它就是标记为 1 的扇区。