Essay recording disk bad sectors fault 2019.8.7

dmesg

When a hard disk damage, there is usually Buffer I / O Error in the output of dmesg information, so always check the output of dmesg you can discover whether there is a hard problem.

badblocks

adblocks can be used to check the hard disk has bad sectors, you can also repair bad sectors, but only logical bad sectors, physical bad sectors can only replace a drive.

Check the command:

[root@localhost ~]# badblocks -s -v -o /root/bb.log /dev/sda

 

Check the / home if there are bad sectors, the command is as follows :

[root@localhost ~]# badblocks -s -v -o /root/bb-home.log /dev/mapper/centos-home

 

Logical bad repair methods

The following is the badblocks / dev / mapper / centos-home e partition checking out bad sectors list:

 

217874591

217874592

217874593

217874594

217874595

 

 

Back up data

[root@localhost ~]# dd if=/dev/mapper/centos-home  skip=217874591 of=/tmp/217874591-217874595.dat count=5

 

repair

[Root @ localhost ~] # umount / dev / mapper / centos-home (umount possible "Device busy" error occurs, the solution fuser -m / home // lists use / home process ID fuser -m -v - i -k / home // list the PID and kill off the process)

Repair command:

[root@localhost ~]# badblocks -s -w /dev/mapper/ centos-home 217874595 217874591

 

Repair after inspection

[root@localhost ~]# badblocks -s -v /dev/mapper/ centos-home 217874595 217874591

 

Data recovery (optional)

[root@localhost ~]# dd if=/tmp/217874591-217874595.dat of=/dev/mapper/ centos-home

 

Repartition check

[root@localhost ~]# badblocks -s -v -o /root/bb-home.log /dev/mapper/ centos-home

 

If no instructions to repair bad sectors has been completed, if bad sectors may try to repeat the above method.

 

After the completion of re-mount the partition

 

[root@localhost ~]# mount /dev/mapper/ centos-home

 

Guess you like

Origin www.cnblogs.com/lyqlyqlyq/p/11314460.html