只读文件系统 - 未恢复的读取错误 - 自动重新分配失败

只读文件系统 - 未恢复的读取错误 - 自动重新分配失败

我们的 Ubuntu 转向只读文件系统。

我检查了 dmesg 日志,发现以下内容:

kernel: ata5.00: exception Emask 0x0 SAct 0x200000 SErr 0x0 action 0x0
kernel: ata5.00: irq_stat 0x40000008
kernel: ata5.00: failed command: READ FPDMA QUEUED
kernel: ata5.00: cmd 60/08:a8:68:08:80/00:00:3f:00:00/40 tag 21 ncq dma 4096 in
                 res 51/40:08:68:08:80/00:00:3f:00:00/40 Emask 0x409 (media error) <F>
kernel: ata5.00: status: { DRDY ERR }
kernel: ata5.00: error: { UNC }
kernel: ata5.00: configured for UDMA/133
kernel: sd 4:0:0:0: [sda] tag#21 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
kernel: sd 4:0:0:0: [sda] tag#21 Sense Key : Medium Error [current] 
kernel: sd 4:0:0:0: [sda] tag#21 Add. Sense: Unrecovered read error - auto reallocate failed
kernel: sd 4:0:0:0: [sda] tag#21 CDB: Read(10) 28 00 3f 80 08 68 00 00 08 00
kernel: blk_update_request: I/O error, dev sda, sector 1065355368 op 0x0:(READ) flags 0x3000 phys_seg 1 prio clas>
kernel: EXT4-fs error (device sda1): ext4_wait_block_bitmap:519: comm kworker/u16:0: Cannot read block bitmap - b>
kernel: ata5: EH complete
kernel: Aborting journal on device sda1-8.
kernel: EXT4-fs (sda1): Remounting filesystem read-only

尝试获取 smartctl 数据但未安装(现在无法安装)。

我从中获得的唯一信息是:Unrecovered read error - auto reallocate failed

我还没有关掉电脑……但这是否意味着硬盘快坏了?fcsk 能修复它吗?日志中是否有我遗漏的相关内容?或者我应该开始寻找新的驱动器?

答案1

NCQ 错误

kernel: ata5.00: failed command: READ FPDMA QUEUED
kernel: ata5.00: cmd 60/08:a8:68:08:80/00:00:3f:00:00/40 tag 21 ncq dma 4096 in

本机命令队列 (NCQ) 是串行 ATA 协议的扩展,允许硬盘驱动器内部优化接收的读写命令的执行顺序。

编辑sudo -H gedit /etc/default/grub并更改以下行以包含此额外参数。然后执行sudo update-grub将更改写入磁盘。重新启动。监控挂起/等,并观察grep -i FPDMA /var/log/syslog*dmesg是否有持续的错误消息。

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash libata.force=noncq"

文件系统检查

  • 以“试用 Ubuntu”模式启动 Ubuntu Live DVD/USB
  • terminalCtrl+ Alt+打开窗口T
  • 类型sudo fdisk -l
  • 识别“Linux 文件系统”的 /dev/sdXX 设备名称
  • 输入sudo fsck -f /dev/sda1,替换sdXX为您之前找到的数字
  • fsck如果有错误则重复命令
  • 类型reboot

坏块

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

注意:不要对 SSD 造成坏块

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

注意:这将花费很多小时

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

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

terminal...

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

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

或者

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

-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.

相关内容