我有一个通过 UBS3 连接的 8TiB 磁盘,并将其格式化为 3 个 EXT3 分区,我将其用作备份驱动器(它插入 SATA 底座)。
该磁盘已连接并安装了几天,但未被明确写入(几天前我备份了一些数据)。
我碰巧看了一下 dmesg 并发现了以下内容(经过过滤仅显示与磁盘名称 sdg 匹配的条目):
[393945.628890] EXT4-fs (sdg2): error count since last fsck: 4
[393945.628894] EXT4-fs (sdg2): initial error at time 1589268773: ext4_validate_block_bitmap:406
[393945.628897] EXT4-fs (sdg2): last error at time 1589336019: ext4_validate_block_bitmap:406
[394076.698059] EXT4-fs (sdg1): error count since last fsck: 103
[394076.698063] EXT4-fs (sdg1): initial error at time 1589216157: ext4_validate_block_bitmap:406
[394076.698066] EXT4-fs (sdg1): last error at time 1589372294: ext4_lookup:1590: inode 186081476
自从对该磁盘进行分区和格式化以来,我从未在该磁盘上运行过 fsck。鉴于尚未运行 fsck,如何发现错误以及我应该有多担心?
当我今天早上重新启动系统时,我再次检查了 dmesg 并发现(再次过滤以仅显示与 sdg 匹配的条目)
[ 261.721822] sd 9:0:0:0: [sdg] Spinning up disk...
[ 274.051062] sd 9:0:0:0: [sdg] 15628053168 512-byte logical blocks: (8.00 TB/7.28 TiB)
[ 274.051065] sd 9:0:0:0: [sdg] 4096-byte physical blocks
[ 274.051137] sd 9:0:0:0: [sdg] Write Protect is off
[ 274.051140] sd 9:0:0:0: [sdg] Mode Sense: 43 00 00 00
[ 274.051297] sd 9:0:0:0: [sdg] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 274.051498] sd 9:0:0:0: [sdg] Optimal transfer size 33553920 bytes not a multiple of physical block size (4096 bytes)
[ 274.134309] sdg: sdg1 sdg2 sdg3
[ 274.135296] sd 9:0:0:0: [sdg] Attached SCSI disk
[ 274.654835] EXT4-fs (sdg3): mounting ext3 file system using the ext4 subsystem
[ 274.696860] EXT4-fs (sdg3): warning: mounting fs with errors, running e2fsck is recommended
[ 274.766709] EXT4-fs (sdg1): mounting ext3 file system using the ext4 subsystem
[ 274.795109] EXT4-fs (sdg1): warning: mounting fs with errors, running e2fsck is recommended
[ 274.825210] EXT4-fs (sdg2): mounting ext3 file system using the ext4 subsystem
[ 274.891191] EXT4-fs (sdg2): warning: mounting fs with errors, running e2fsck is recommended
[ 275.713323] EXT4-fs (sdg2): mounted filesystem with ordered data mode. Opts: (null)
[ 276.460528] EXT4-fs (sdg3): mounted filesystem with ordered data mode. Opts: (null)
[ 276.499085] EXT4-fs (sdg1): mounted filesystem with ordered data mode. Opts: (null)
[ 578.549827] EXT4-fs (sdg1): error count since last fsck: 103
[ 578.549830] EXT4-fs (sdg1): initial error at time 1589216157: ext4_validate_block_bitmap:406
[ 578.549832] EXT4-fs (sdg1): last error at time 1589372294: ext4_lookup:1590: inode 186081476
[ 578.549836] EXT4-fs (sdg3): error count since last fsck: 47
[ 578.549837] EXT4-fs (sdg3): initial error at time 1589268525: htree_dirblock_to_tree:1022: inode 31604737: block 126419458
[ 578.549840] EXT4-fs (sdg3): last error at time 1589380312: ext4_lookup:1594: inode 33701921
[ 578.549844] EXT4-fs (sdg2): error count since last fsck: 4
[ 578.549845] EXT4-fs (sdg2): initial error at time 1589268773: ext4_validate_block_bitmap:406
[ 578.549847] EXT4-fs (sdg2): last error at time 1589336019: ext4_validate_block_bitmap:406
[ 639.938843] EXT4-fs (sdg1): mounting ext3 file system using the ext4 subsystem
[ 640.950738] EXT4-fs (sdg1): mounted filesystem with ordered data mode. Opts: (null)
[ 650.900006] EXT4-fs (sdg2): mounting ext3 file system using the ext4 subsystem
[ 651.207658] EXT4-fs (sdg2): mounted filesystem with ordered data mode. Opts: (null)
[ 658.836040] EXT4-fs (sdg3): mounting ext3 file system using the ext4 subsystem
[ 659.084558] EXT4-fs (sdg3): mounted filesystem with ordered data mode. Opts: (null)
因此系统知道存在错误,并且仍然安装了磁盘,而没有显示除 dmesg 中的条目之外的任何警告。
大约 30 分钟后,我又再次检查,因为我很好奇,结果发现:
[ 955.353027] EXT4-fs (sdg2): error count since last fsck: 3248
[ 955.353031] EXT4-fs (sdg2): initial error at time 1589268773: ext4_validate_block_bitmap:406
[ 955.353033] EXT4-fs (sdg2): last error at time 1589437923: ext4_map_blocks:604: inode 103686210: block 1947002998
[ 955.353039] EXT4-fs (sdg1): error count since last fsck: 103
[ 955.353040] EXT4-fs (sdg1): initial error at time 1589216157: ext4_validate_block_bitmap:406
[ 955.353042] EXT4-fs (sdg1): last error at time 1589372294: ext4_lookup:1590: inode 186081476
[ 956.751484] EXT4-fs error (device sdg2): ext4_map_blocks:604: inode #103686210: block 1947002998: comm updatedb.mlocat: lblock 12 mapped to illegal pblock 1947002998 (length 1)
[ 956.767496] EXT4-fs error (device sdg2): ext4_map_blocks:604: inode #103686210: block 1947002998: comm updatedb.mlocat: lblock 12 mapped to illegal pblock 1947002998 (length 1)
[ 956.782683] EXT4-fs warning (device sdg2): htree_dirblock_to_tree:994: inode #103686210: lblock 12: comm updatedb.mlocat: error -117 reading directory block
哎呀!sdg2 的错误数量增加了!
一直以来我都没有明确地写入磁盘。
在使用 gparted 对驱动器进行分区和格式化之前,我使用 fsck 运行了坏块扫描(花了几天时间),没有发现任何错误。这也是一个新磁盘。因此,我有理由相信硬件是好的。
这里可能发生了什么?我应该有多担心这个磁盘上的文件系统的完整性?我的下一步应该怎么做?
答案1
这些错误出现在内核 dmesg 日志中,因为它们是在使用文件系统时遇到的。就是这么简单。
首先,安装磁盘需要从文件系统读取某些信息,如果该信息损坏或不一致,则会在内核 dmesg 日志中记录。
不幸的是,磁盘在闲置一段时间后,即使您没有写入任何内容,也会随着时间推移而退化。原因可能有很多 - 机械、电气、冲击损坏、环境磁性、热应力,甚至环境背景辐射。即使不使用,磁盘也不能永远存在。
我建议你尽快从该磁盘恢复所有可以恢复的内容。即便如此,你还是可能会发现一些文件已损坏 - 但愿一切顺利。