当 fdisk 显示但 lsblk 没有显示故障 ssd 的信息时,fsck、mke2fs 或 e2fsck?

当 fdisk 显示但 lsblk 没有显示故障 ssd 的信息时,fsck、mke2fs 或 e2fsck?

Kubuntu 22.04。当我无法再从 SSD 中删除文件和文件夹时,我开始怀疑 SSD 存在问题,遗憾的是 badblocks 确认存在大量坏块。SSD 不用于启动 Linux,而是用于与 Linux 系统安装分开的数据的单独第二个 SSD,此机器上也没有 Windows。令我惊恐的是,我没有数据备份,包括家庭和工作数据,我知道今后我必须遵循 3-2-1 备份策略。保持冷静,阅读手册、帖子、回复并希望一切顺利。

在 PartedMagic 中,我尝试使用 创建ddrescueSSD 映像gddrescue

ddrescue -f -n -v /dev/sdb dev_sdb_image.img dev_sdb_recovery.log
non-trimmed: 13025 KB
bad-sector: 0 B
bad areas: 0 B
read errors: 375

但是,由于目标已满,1 天 5 小时 39 分钟后,该操作失败,已达到 99.16%。不确定我是否可以使用该映像。Write error: No space left on device我目前正在等待更大的硬盘,因此请创建一个新映像。

由于我需要从 SSD 中获取 1 个文件夹,所以我使用 UBS/SATA 适配器将其插入,然后能够安全地获取文件

rsync --archive --progress --verbose --human-readable /source/ /destination/ --log-file=/restore.log

然后再次安全地移除 SSD。那是昨天的事了。今天我尝试再次通过 USB/SATA 适配器插入 SSD 以从中获取更多文件夹和文件,但没有成功。

dmesg 日志

[  861.270830] sd 3:0:0:0: [sdc] Very big device. Trying to use READ CAPACITY(16).
[  861.271143] sd 3:0:0:0: [sdc] 7814037168 512-byte logical blocks: (4.00 TB/3.64 TiB)
[  861.271677] sd 3:0:0:0: [sdc] Write Protect is off
[  861.271686] sd 3:0:0:0: [sdc] Mode Sense: 43 00 00 00
[  861.272112] sd 3:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[  861.281356]  sdc: sdc1 sdc2
[  861.281545] sd 3:0:0:0: [sdc] Attached SCSI disk
[  987.435570] usb 2-4: USB disconnect, device number 4
[  987.443424] Buffer I/O error on dev sdc1, logical block 0, async page read
[  987.443467] Buffer I/O error on dev sdc1, logical block 0, async page read
[  987.487303] sd 3:0:0:0: [sdc] Synchronizing SCSI cache
[  987.487331] sd 3:0:0:0: [sdc] Synchronize Cache(10) failed: Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK

lsblk -a

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sdb           8:16   0   3.6T  0 disk
├─sdb1        8:17   0   3.4T  0 part
└─sdb2        8:18   0   200G  0 part

sudo smartctl -a /dev/sdb

smartctl 7.2 2020-12-30 r5155 [x86_64-linux-6.5.0-28-generic] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model:     Samsung SSD 870 EVO 4TB
Serial Number:    
LU WWN Device Id: 5 002538 f71203d5c
Firmware Version: SVT01B6Q
User Capacity:    4’000’787’030’016 bytes [4.00 TB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
Form Factor:      2.5 inches
TRIM Command:     Available, deterministic, zeroed
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   ACS-4 T13/BSR INCITS 529 revision 5
SATA Version is:  SATA 3.3, 6.0 Gb/s (current: 3.0 Gb/s)
Local Time is:    Wed May  1 11:54:24 2024 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

Read SMART Data failed: scsi error aborted command

=== START OF READ SMART DATA SECTION ===
SMART Status command failed: scsi error aborted command
SMART overall-health self-assessment test result: UNKNOWN!
SMART Status, Attributes and Thresholds cannot be read.

Read SMART Log Directory failed: scsi error aborted command
Read SMART Error Log failed: scsi error aborted command
Read SMART Self-test Log failed: scsi error aborted command
Selective Self-tests/Logging not supported

有很多帖子和视频都提到了Samsung SSD 870 EVO 4TB之前创建的批次失败2021/11,如果您有该日期之前的版本,请帮自己一个大忙,立即备份您的数据。此 SSD 来自2021/03

sudo fdisk -l
这大约需要10分钟才能完成。

...
Disk /dev/sdb: 3.64 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: 2105
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: 

Device          Start        End    Sectors  Size Type
/dev/sdb1        2048 7394607103 7394605056  3.4T Linux filesystem
/dev/sdb2  7394607104 7814035455  419428352  200G Linux filesystem

sudo fsck /dev/sdb

fsck from util-linux 2.37.2
e2fsck 1.46.5 (30-Dec-2021)
ext2fs_open2: Bad magic number in super-block
fsck.ext2: Superblock invalid, trying backup blocks...
fsck.ext2: Bad magic number in super-block while trying to open /dev/sdb

The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem.  If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>
 or
    e2fsck -b 32768 <device>

Found a gpt partition table in /dev/sdb

/dev/sb1在此过程中,分区名称DATA短暂地出现在 Dolphin 中,然后又消失了。这确实发生在我没有尝试加载 SSD 的情况下,它只是在上述命令运行时自动发生的。

不确定如何继续,我尝试检查文件系统,lsblk -f但没有显示任何结果,但是上面fdisk -l显示它是一个 Linux 文件系统,我也很确定在使用它之前我在 Gparted 中使用 ext4 格式化了它。

lsblk -f

NAME     FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
...
sdb
├─sdb1
└─sdb2

sudo fsck -n /dev/sdb1

fsck from util-linux 2.37.2
e2fsck 1.46.5 (30-Dec-2021)
DATA contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Error reading block 53493762 (Input/output error) while reading directory block.  Ignore error? no

Error reading directory block 53493762 (inode 13372339): Input/output error
Continue? no

e2fsck: aborted

DATA: ********** WARNING: Filesystem still has errors **********

看来 SSD 上的第二个分区没有问题,只是/dev/sdb1受到了影响。 sudo fsck -n /dev/sdb2

fsck from util-linux 2.37.2
e2fsck 1.46.5 (30-Dec-2021)
/dev/sdb2: clean, 1120854/13107200 files, 16540762/52428544 blocks

请问我现在该怎么做?

1. 尝试使用??修复/dev/sdb1出现输入/输出错误的分区。fsck
sudo fsck -f /dev/sdb1

2.尝试修复SSD超级块中的魔法数字?
mke2fs -n /dev/sdb
fsck -b $SUPERBLOCK_OUTPUT

3.尝试运行e2fsck
e2fsck -b 8193 /dev/sdb1
e2fsck -b 32768 /dev/sdb1

不用说,我在这里学到了一个非常糟糕和艰难的教训,有两种人,一种人有备份,另一种人丢失数据,是的,我知道。谢谢你的帮助。

相关内容