我今天醒来发现我的 CentOS 服务器的文件系统已设置为只读模式。我在此服务器上运行 RAID 1。
# mkdir test
mkdir: cannot create directory `test': Read-only file system
我做了一些研究,发现这通常是由硬件问题引起的,即硬盘即将出现故障。
我如何确定这是一个硬件问题而不是软件问题?
如果是硬件问题:我如何找出两个驱动器中的哪一个有故障并需要更换?Smartctl 对两个驱动器都显示“已通过”,尽管一个驱动器显示 678 个重新分配的扇区,另一个驱动器显示 33 个重新分配的扇区。(再次,我使用的是 RAID 1)
dmesg 输出
ata2.00: exception Emask 0x0 SAct 0x4000000 SErr 0x0 action 0x0
ata2.00: irq_stat 0x40000008
ata2.00: failed command: READ FPDMA QUEUED
ata2.00: cmd 60/08:d0:58:11:38/00:00:01:00:00/40 tag 26 ncq 4096 in
res 51/40:02:5e:11:38/00:00:01:00:00/40 Emask 0x409 (media error) <F>
ata2.00: status: { DRDY ERR }
ata2.00: error: { UNC }
ata2.00: configured for UDMA/133
sd 1:0:0:0: [sdb]
Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
sd 1:0:0:0: [sdb]
Sense Key : Medium Error [current] [descriptor]
Descriptor sense data with sense descriptors (in hex):
72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00
01 38 11 5e
sd 1:0:0:0: [sdb]
Add. Sense: Unrecovered read error - auto reallocate failed
sd 1:0:0:0: [sdb] CDB:
Read(16): 88 00 00 00 00 00 01 38 11 58 00 00 00 08 00 00
end_request: I/O error, dev sdb, sector 20451678
EXT3-fs error (device md2): ext3_get_inode_loc: unable to read inode block - inode=637820, block=2555947
ata2: EH complete
Aborting journal on device md2.
EXT3-fs (md2): error: ext3_journal_start_sb: Detected aborted journal
EXT3-fs (md2): error: remounting filesystem read-only
EXT3-fs (md2): error: remounting filesystem read-only
__journal_remove_journal_head: freeing b_committed_data
__journal_remove_journal_head: freeing b_frozen_data
__journal_remove_journal_head: freeing b_committed_data
ata2.00: exception Emask 0x0 SAct 0x1000006 SErr 0x0 action 0x0
ata2.00: irq_stat 0x40000008
ata2.00: failed command: READ FPDMA QUEUED
ata2.00: cmd 60/08:c0:58:11:38/00:00:01:00:00/40 tag 24 ncq 4096 in
res 51/40:02:5e:11:38/00:00:01:00:00/40 Emask 0x409 (media error) <F>
ata2.00: status: { DRDY ERR }
ata2.00: error: { UNC }
ata2.00: configured for UDMA/133
sd 1:0:0:0: [sdb]
Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
sd 1:0:0:0: [sdb]
Sense Key : Medium Error [current] [descriptor]
Descriptor sense data with sense descriptors (in hex):
72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00
01 38 11 5e
sd 1:0:0:0: [sdb]
Add. Sense: Unrecovered read error - auto reallocate failed
sd 1:0:0:0: [sdb] CDB:
Read(16): 88 00 00 00 00 00 01 38 11 58 00 00 00 08 00 00
end_request: I/O error, dev sdb, sector 20451678
EXT3-fs error (device md2): ext3_get_inode_loc: unable to read inode block - inode=637807, block=2555947
ata2: EH complete
答案1
您的磁盘sdb
即将坏掉,Unrecovered read error - auto reallocate failed
错误意味着无法重新分配坏块,磁盘随时可能坏掉。在我们的案例中,出现此类错误的磁盘dmesg
将在近期(一个月或最多两个月)坏掉。此外,如果您的磁盘在 SMART 中不断增长Reallocated_Sector_Ct
,则意味着您的磁盘处于故障前状态,您应该警告更换磁盘。