centos出现磁盘坏掉,怎么修复和检测。

当dmesg的时候,出现下面的信息说明磁盘有问题

Info fld=0x139066d0 end_request: I/O error, dev sda, sector 328230608 Buffer I/O error on device sda, logical block 41028826 sd 0:0:0:0: SCSI error: return code = 0x08000002 sda: Current: sense key: Medium Error Add. Sense: Unrecovered read error Info fld=0x139066d0 end_request: I/O error, dev sda, sector 328230608 Buffer I/O error on device sda, logical block 41028826 sd 0:0:0:0: SCSI error: return code = 0x08000002 sda: Current: sense key: Medium Error Add. Sense: Unrecovered read error Info fld=0x139066d0 end_request: I/O error, dev sda, sector 328230608 Buffer I/O error on device sda, logical block 41028826 sd 0:0:0:0: SCSI error: return code = 0x08000002 sda: Current: sense key: Medium Error Add. Sense: Unrecovered read error Info fld=0x139066d0 end_request: I/O error, dev sda, sector 328230608 Buffer I/O error on device sda, logical block 41028826 sd 0:0:0:0: SCSI error: return code = 0x08000002 sda: Current: sense key: Medium Error Add. Sense: Unrecovered read error

1. 首先检测下坏掉

badblocks -s -v -o /root/bb.log /dev/sda  将结果保存到bb.log

[root@logging ~]# badblocks -s -v -o /root/badblocks.log /dev/sda
Checking blocks 0 to 586061784
Checking for bad blocks (read-only test): done                                
Pass completed, 173 bad blocks found.

 

smartctl -a   /dev/sda3 (快速检测硬盘坏道,看read,write 后面有没有errors)

2. 逻辑坏道修复方法

①、badblocks -s -w /dev/sda END START (END代表需要修复的扇区末端,START代表需要修复的扇区起始端)
②、fsck -a /dev/sda

修复后再用badblocks -s -v -o /root/bb.log /dev/sda监测看是否还有坏道存在,如果坏道还是存在的话说明坏道属于硬盘坏道。硬盘坏道要用隔离方法,首先记录监测出的硬盘坏道然后分区的时候把硬盘坏道所在的扇区分在一个分区(大小一般大于坏扇区大小),划分出的坏道分区不使用即可达到隔离的目的

3. 0磁道坏道和硬盘坏道(准备换硬盘)

0磁道坏道的修复方法是隔离0磁道,使用fdsk划分区的时候从1磁道开始划分区。

如果是硬盘坏道的话,只能隔离不能修复

 

posted @ 2015-02-27 16:07  perry和尚  阅读(15046)  评论(0编辑  收藏  举报