Linux Comm Badblocks
# Linux badblocks Command
[ Linux Command Manual](#)
The Linux `badblocks` command is used to check for bad blocks on a disk device.
When executing the command, you must specify the disk device to be checked and the number of blocks on that device.
### Syntax
`badblocks `
**Parameter Description**:
* `-b ` Specifies the block size of the disk, in bytes.
* `-o ` Writes the check results to the specified output file.
* `-s` Displays progress during the check.
* `-v` Displays detailed information during execution.
* `-w` Performs a write test during the check.
* `` Specifies the disk device to be checked.
* `` Specifies the total number of blocks on the disk device.
* `` Specifies the block number from which to start checking.
### Example
View current hard disk information.
```bash
# fdisk -l
For example, the displayed information might be:
Disk /dev/sda: 298.9 GB, 298999349248 bytes
255 heads, 63 sectors/track, 36351 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 262 2104483+ 82 Linux swap / Solaris
/dev/sda2 * 263 32898 262148670 83 Linux
/dev/sda3 32899 36351 27736222+ 83 Linux
Disk /dev/sdb: 42.9 GB, 42949672960 bytes
64 heads, 32 sectors/track, 40960 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Scan the hard disk using the command.
```bash
# badblocks -s -v /dev/sdnx
Here, `n` represents the hard disk device name, and `x` represents the partition number corresponding to the hard disk. For example, to check "/dev/sda2", execute the following command:
```bash
# badblocks -s -v /dev/sda2
Checking blocks 0 to 30681000
Checking for bad blocks (read-only test): 30680960
0674112/ 306810000000
30680964
30680965
30680966
30680967
30680968
30680969
30680970
30680971
30680972
30680973
...
done
Pass completed, 37 bad blocks found.
Here, "37 bad blocks found" indicates that there are 37 bad blocks on the hard disk.
[ Linux Command Manual](#)
YouTip