断电后,gparted/fdisk 报告 ssd 磁盘表不正确。如何修复

断电后,gparted/fdisk 报告 ssd 磁盘表不正确。如何修复

断电后,gparted/fdisk 报告 ssd 磁盘表不正确。如何修复

每次断电,都会发生同样的事情。ssd 关闭,gdisk 表示表超出磁盘限制。我认为某些 ssd 扇区已烧毁(?),但 GPT 信息却表明并非如此。我该怎么办?Gparted 说将使用主表,但随后它显示它完全是空的。

如果 SSD 的行为如此,我就无法信任它。

然而,第二个问题是哪些扇区被烧毁了?是末端的扇区吗?是中间的扇区吗?还是其他随机的扇区?

当我在 fdisk 中按下“w”时,它显示错误已修复,但再次运行时出现同样的问题。无法在此磁盘上运行 fsck。

您知道如何解决这个问题吗?

sudo gdisk  /dev/sdb 
GPT fdisk (gdisk) version 1.0.9

Warning! Disk size is smaller than the main header indicates! Loading
secondary header from the last sector of the disk! You should use 'v' to
verify disk integrity, and perhaps options on the experts' menu to repair
the disk.
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: ERROR

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/sdb: 234439535 sectors, 111.8 GiB
Model: KINGSTON SV300S3
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 17EEF8B4-C4A6-4203-BFE0-2626FAFA4FA4
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 234441614
Partitions will be aligned on 2048-sector boundaries
Total free space is 2925 sectors (1.4 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048       234440703   111.8 GiB   8300  Linux filesystem


Command (? for help): w
Caution! Secondary header was placed beyond the disk's limits! Moving the
header, but other problems may occur!

Warning! Secondary partition table overlaps the last partition by
1202 blocks!
You will need to delete this partition or resize it in another utility.

Problem: partition 1 is too big for the disk.
Aborting write operation!
Aborting write of new partition table.


Expert command (? for help): i
Using 1
Partition GUID code: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 (Linux filesystem)
Partition unique GUID: BAA6823F-B077-41B3-95D1-4CF4EF30FA95
First sector: 2048 (at 1024.0 KiB)
Last sector: 234440703 (at 111.8 GiB)
Partition size: 234438656 sectors (111.8 GiB)
Attribute flags: 0000000000000000
Partition name: 'Linux filesystem'


Expert command (? for help): v

Caution: The CRC for the backup partition table is invalid. This table may
be corrupt. This program will automatically create a new backup partition
table when you save your partitions.

Problem: partition 1 is too big for the disk.

Warning! Secondary partition table overlaps the last partition by
1202 blocks!
You will need to delete this partition or resize it in another utility.

选择什么选项?

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

测试盘更新



Disk /dev/sdb - 120 GB / 111 GiB - KINGSTON SV300S37A120G

Hidden sectors are present.

size       234439535 sectors
user_max   234439535 sectors
native_max 234441648 sectors
Host Protected Area (HPA) present.



superblock 0, blocksize=4096 [tmp_ssd]
superblock 32768, blocksize=4096 [tmp_ssd]
superblock 98304, blocksize=4096 [tmp_ssd]
superblock 163840, blocksize=4096 [tmp_ssd]
superblock 229376, blocksize=4096 [tmp_ssd]
superblock 294912, blocksize=4096 [tmp_ssd]
superblock 819200, blocksize=4096 [tmp_ssd]
superblock 884736, blocksize=4096 [tmp_ssd]
superblock 1605632, blocksize=4096 [tmp_ssd]
superblock 2654208, blocksize=4096 [tmp_ssd]

To repair the filesystem using alternate superblock, run
fsck.ext4 -p -b superblock -B blocksize device

continue - efi/gpt table - advanced - superblock (otherwise dont list files)  - quit - list

所有文件都在那里!

更新 2 我在 testdisk 上使用专家模式,然后进行分析,发现存在写入“w”选项。我按下了它。它说更改将在重新启动时生效。

为了重新加载分区,我使用了 partprobe /dev/sdb“分区不能在磁盘之外”的提示,但 kpartx -u /dev/sdb hdparm -z /dev/sdb blockdev --rereadpt /dev/sdb 没有任何效果。可能的更改尚未写入磁盘?

更新 NO3 文件树永远重复这种情况发生在我身上好几次了,所以当一些扇区关闭时,一些文件会变成目录和循环我不知道为什么块/gpt 表和其他的备份完全无法恢复结构。也许有些扇区关闭了,读取正在循环。因此,磁盘内部必须知道哪些扇区关闭了,以及在这些扇区中写入了哪些文件。

目录 A --> 文件 A 文件 B 文件 C.dir --> 目录 A -> 文件 A 文件 B 文件 C.dir --> 目录 A -> 文件 A 文件 B ......(文件已成为重复的目录)因此 testdisk 必须检测此类情况和其他实用程序并进行修复。也许正是因为这个原因,分区才会超出磁盘?

更新 NO4 重启后,没有写入任何对 SSD 的更改 - 同样的情况

更新 No5 我在 askubuntu 中读到“您陷入了循环。由于表格已损坏,因此您无法调整大小;由于表格重叠,因此您无法修复表格”。

我的结论是:

  1. 当 gpt 情况不好时,没有低级工具可以强制“调整分区大小”到边界。我的磁盘几乎是空的。删除一些扇区不会有问题。
  • 对于该问题我建议,磁盘必须包含哪些文件占用哪些扇区的信息作为原始信息(例如文件A 扇区 1 和 2)。因此,这些信息可以部分修复损坏。
  1. 我找不到让 SSD 磁盘退出读取模式的方法。任何尝试都失败了。这对专家用户来说是错误的。
  • Testdisk 在专家模式下有一个写入选项。但是,它也会失败。
  1. 如果没有其他更好的解决方案,Linux 中的数据恢复工具必须修复“超出边界的 GPT”和“只读模式”,即使存在一些数据损坏。

请注意,smartctl -a 中的所有 ssd 统计信息都为零(最佳情况)。

SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x0033   120   120   050    Pre-fail  Always       -       0/0
  5 Retired_Block_Count     0x0033   100   100   003    Pre-fail  Always       -       0
  9 Power_On_Hours_and_Msec 0x0032   087   087   000    Old_age   Always       -       12150h+07m+16.700s
 12 Power_Cycle_Count       0x0032   099   099   000    Old_age   Always       -       1233
171 Program_Fail_Count      0x000a   000   000   000    Old_age   Always       -       0
172 Erase_Fail_Count        0x0032   000   000   000    Old_age   Always       -       0
174 Unexpect_Power_Loss_Ct  0x0030   000   000   000    Old_age   Offline      -       251
177 Wear_Range_Delta        0x0000   000   000   000    Old_age   Offline      -       1
181 Program_Fail_Count      0x000a   000   000   000    Old_age   Always       -       0
182 Erase_Fail_Count        0x0032   000   000   000    Old_age   Always       -       0
187 Reported_Uncorrect      0x0012   100   100   000    Old_age   Always       -       0
189 Airflow_Temperature_Cel 0x0000   028   045   000    Old_age   Offline      -       28 (Min/Max 4/45)
194 Temperature_Celsius     0x0022   028   045   000    Old_age   Always       -       28 (Min/Max 4/45)
195 ECC_Uncorr_Error_Count  0x001c   120   120   000    Old_age   Offline      -       0/0
196 Reallocated_Event_Count 0x0033   100   100   003    Pre-fail  Always       -       0
201 Unc_Soft_Read_Err_Rate  0x001c   120   120   000    Old_age   Offline      -       0/0
204 Soft_ECC_Correct_Rate   0x001c   120   120   000    Old_age   Offline      -       0/0
230 Life_Curve_Status       0x0013   100   100   000    Pre-fail  Always       -       100
231 SSD_Life_Left           0x0013   100   100   010    Pre-fail  Always       -       0
233 SandForce_Internal      0x0032   000   000   000    Old_age   Always       -       5873
234 SandForce_Internal      0x0032   000   000   000    Old_age   Always       -       6119
241 Lifetime_Writes_GiB     0x0032   000   000   000    Old_age   Always       -       6119
242 Lifetime_Reads_GiB      0x0032   000   000   000    Old_age   Always       -       22886
 

我可以建议磁盘可以携带电池以应对断电吗?

相关内容