Badblocks Check whether the hard disk has bad sectors

Hard drive is relatively easy to broken equipment,It may appear bad sectors and other physical failure after a period of time。When the hard disk bad sectors,If not promptly replaced or conduct technical process,Disk bad sectors will be more and more,And would cause frequent crashes and data loss。The best approach is to replace the new disk。In the case of temporary,We should be part of the bad sectors sector shields,Do not touch them。

badblocks is to check whether a disk has bad sectors Tools,Can be read way to check,You can also check the way to write。

Here,I use

badblocks -v /dev/sda

Check for bad sectors,Test results without error

 

 

 

 

badblocks parameter options

-b blocksize
Block size specified disk,Bytes,The default value is "block 4K"(4K/block)
-c blocksize
Check the number of times each block,The default is 16
-f
Non-destructive read enforcement on an already mounted equipment write test operation
(We recommend that you umount equipment,Then to detect bad sectors。Only when the / etc / mtab mount the wrong device false positives when you can use this option)
-i file
Skip has been shown to bad sectors in the file file,Without detection (to avoid duplicate detection)
-or file
The detection result is output to the file file
-p number
Repeat search devices,Until a specified number of times through no bad blocks to find a new location,The default number is 0
-s
It shows progress check
-t pattern
By pressing the designated read mode is detected block。You can specify a decimal 0 to ULONG_MAX-1 positive value,Or random (stochastic)。
If you specify more than one mode,badblocks will use the first pattern detecting all blocks,Then use one mode to detect all of the blocks。
Read-only mode accepts only a mode,It can not accept random pattern。
-v
Display detailed information about the implementation
-w
Are the first written for each block,Then read information from it
[device]
Specifies the disk device to be checked。
[last-block]
The total number of blocks specified disk device。
[start-block]
Specifies the block from which you want to start checking

Leave a Comment