How to search bad blocks on a device?
Posted on In QAIf I have a disk with bad blocks, how to search bad blocks on it under Linux?
You can use ‘badblocks’: https://www.systutorials.com/docs/linux/man/8-badblocks/
badblocks [ -svwnf ] [ -b block-size ] [ -c blocks_at_once ] [ -e max_bad_blocks ] [ -d read_delay_factor ] [ -i input_file ] [ -o output_file ] [ -p num_passes ] [ -t test_pattern ] device [ last-block ] [ first-block ]
badblocks is used to search for bad blocks on a device (usually a disk partition). device is the special file corresponding to the device (e.g /dev/hdc1). last-block is the last block to be checked; if it is not specified, the last block on the device is used as a default. first-block is an optional parameter specifying the starting block number for the test, which allows the testing to start in the middle of the disk. If it is not specified the first block on the disk is used as a default.