centos7-- soft raid in hard drive failure recovery

The system being given a piece of damaged disk sectors, although there was no impact on reading and writing, but in the future may be a problem, so be prepared to do repair

dmesg error:

 

  error message:

 

Began to repair

 --------------------------------------------------------

1, first check if indeed there is damage to the hard disk

Smartctl can be detected whether the hard disk has bad sectors, PASSED normal, FAILED indicates that there are bad sectors

If not smartctl, can yum install -y smartmontools-6.5-1.el7.x86_64 mounted yum # If not, yum whatprovides * / smartctl look

 

2, badblock error scan disk sectors

badblock is a full disk scan, hit badblock.log will enter the damaged hard disk sector number, the time will be somewhat longer, nohup hanging background

nohup badblocks -s -v -o ~/badblock.log /dev/sdk &

ps -elf | grep badblock ## background check process, if not, it means that the sector has been scanned

Note: If the above scan output is not a bad sector, and there may be a default sector byte badblock Inconsistent as

The default is a 512-byte sector, the time to scan badblock 1024 byte is a sector, it will go directly to the scan

FIG default to a 512-byte sector, the total number of sectors 5860533168, badblock when a sector scan in 1024, the total number of sectors 2930266583

 

 Therefore, we use the error message inside the sector by 2 to obtain the sector is wrong when badblock scanning,

nohup badblocks -sv  -o /home/ganwenhao/badblock.log /dev/sdh 2930266583  2867755208 &

3, after the scan is complete, cat view generated error sector number, badblock.log, as follows:

 

 4 ,, stop the raid, we need to stop the soft raid, in order to do the repair disk

  mdadm -S / dev / md0 # Stop soft raid
 umount / unloading Data2 # mount disk raid
5, to begin the repair sector

 badblocks -s -w / dev / sdk END START sector number

 

Repair soon after the repair is completed can check, no bad sectors
badblocks -v / dev / sdk 23169707 23169704

 

After the repair loading RAID,
the mdadm -A / dev / MD0 / dev / SD [BM]

mdadm -D / dev / md0 normal load check raid

 --end--

Welcome exchanges, have questions, please leave a message, although I do not necessarily see ~~

Guess you like

Origin www.cnblogs.com/ad-note/p/11453648.html