坏块发现读取错误后,重新分配的扇区数未更新

坏块发现读取错误后,重新分配的扇区数未更新

我的 HD 上有几个损坏的文件,所以我想检查所有扇区并让 HD 控制器标记故障的扇区。

遵循这些建议回答,我已经在外部硬盘上运行了badblocks。从答案来看,这个命令force checking of all sectors [...] If you have fully processed your disk this way, the disk controller should have replaced all bad blocks by working ones and the reallocated count will be increased in the SMART log.

我运行这个命令sudo badblocks -svvn -c 262144 /dev/sdd

结果是 Pass completed, 103 bad blocks found. (103/0/0 errors)

我做了一个sudo smartctl --all /dev/sdd前后对比badblocks,发现有一些不同,但并不在,Reallocated_Sector_Ct尽管badblocks发现了 103 个读取错误。之后badblocks我仍然得到与之前相同的输出:

  5 Reallocated_Sector_Ct   0x0033   200   200   140    Pre-fail  Always    -       0

区别仅在于:
1- 之间Raw_Read_Error_Rate

Before badblocks:
    1 Raw_Read_Error_Rate   0x002f   196   196   051    Pre-fail  Always    -       429
After badblocks:
    1 Raw_Read_Error_Rate   0x002f   191   189   051    Pre-fail  Always    -       1221

2- 之间Current_Pending_Sector:但在这里,原始值增加之后,badblocks这对我来说没有意义Pending are sectors which might be reallocated in case the next write fails。如果发现坏扇区,数字应该会减少……还是我遗漏了什么?

Before badblocks:
    197 Current_Pending_Sector  0x0032   200   200   000    Old_age   Always    -       16
After badblocks:
    197 Current_Pending_Sector  0x0032   200   200   000    Old_age   Always    -       24

我的主要问题是disk controller我的 HD 现在是否知道哪些扇区是坏的并且不会再使用它们,还是只是badblocks简单地通知我,而对我的 HD 将来的工作方式没有任何影响?


编辑3:

ubuntu@ubuntu:~$ sudo e2fsck -fccky /dev/sdd
e2fsck 1.45.5 (07-Jan-2020)
ext2fs_open2: Bad magic number in super-block
e2fsck: Superblock invalid, trying backup blocks...
e2fsck: Bad magic number in super-block while trying to open /dev/sdd

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 dos partition table in /dev/sdd

编辑2:

ubuntu@ubuntu:~$ lsusb
Bus 002 Device 004: ID 0bda:0138 Realtek Semiconductor Corp. RTS5138 Card Reader Controller
Bus 002 Device 003: ID 13fe:3123 Kingston Technology Company Inc. Verbatim STORE N GO 4GB
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 005: ID 0c45:6473 Microdia
Bus 001 Device 006: ID 0cf3:e004 Qualcomm Atheros Communications
Bus 001 Device 003: ID 04f2:0976 Chicony Electronics Co., Ltd
Bus 001 Device 007: ID 1058:0730 Western Digital Technologies, Inc. My Passport Essential (WDBACY)
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

编辑:我不确定如何做grep -i FPDMA /var/log/syslog*,并且在网上找不到任何信息,所以我只是将命令粘贴到终端中,但什么也没有发生: 在此处输入图片描述

至于Disks SMART Data & Tests,菜单是灰色的:

在此处输入图片描述

答案1

WDC WD5000BMVW-11AMCS0

首先,我们为该 WDC 驱动器禁用 UAS...

# drop this into /etc/modprobe.d/disable_uas.conf
# -rw-r--r--   1 root root  500 Apr 30 06:59 disable-uas.conf
#
# sources:
# https://unix.stackexchange.com/questions/525290/usb-hdd-not-found
# https://unix.stackexchange.com/questions/239782/connection-problem-with-usb3-external-storage-on-linux-uas-driver-problem
#
# examples:
# options usb-storage quirks=059f:105e:u 
# options usb-storage quirks=059f:105f:u,059f:105e:u,174c:1351:u
#
# do these commands:
# sudo update-initramfs -u
# reboot
#
# WDC WD5000BMVW-11AMCS0 drive
# Bus 001 Device 007: ID 1058:0730 Western Digital Technologies, Inc. My Passport Essential (WDBACY)
options usb-storage quirks=1058:0730:u

坏块

然后我们使用推荐的方法对坏块进行处理...

注意:不要中止坏块扫描!

注意:不要对 SSD 造成坏块

注意:请先备份您的重要文件!

注意:这将花费很多小时

注意:您可能面临硬盘故障

在“尝试 Ubuntu”模式下启动 Ubuntu Live DVD/USB。

terminal...

sudo fdisk -l# 识别所有“Linux 文件系统”分区

sudo e2fsck -fcky /dev/sdXX# 只读测试

或者

sudo e2fsck -fccky /dev/sdXX# 非破坏性读写测试(受到推崇的)

-k 很重要,因为它会保存之前的坏块表,并将任何新的坏块添加到该表中。如果没有 -k,您将丢失所有之前的坏块信息。

-fccky 参数...

   -f    Force checking even if the file system seems clean.

   -c    This option causes e2fsck to use badblocks(8) program to do
         a read-only scan of the device in order to find any bad blocks.
         If any bad blocks are found, they are added to the bad block
         inode to prevent them from being allocated to a file or direc‐
         tory.  If this option is specified twice, then the bad block scan
         will be done using a non-destructive read-write test.

   -k    When combined with the -c option, any existing bad blocks in the
         bad blocks list are preserved, and any new bad blocks found by
         running badblocks(8) will be added to the existing bad blocks
         list.

   -y    Assume an answer of `yes' to all questions; allows e2fsck to be
         used non-interactively. This option may not be specified at the
         same time as the -n or -p options.

相关内容