← 返回命令列表

Linux command

badblocks 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Check

badblocks -v [/dev/sdb]

Destructive

badblocks -wsv [/dev/sdb]

Non-destructive

badblocks -nsv [/dev/sdb]

Example

badblocks -o [badblocks.txt] [/dev/sdb]

说明

badblocks searches a device for bad blocks by performing read, write, or non-destructive read-write tests. It's used to verify disk integrity and create lists of bad blocks for filesystem tools. The tool is particularly useful for testing new drives or diagnosing failing storage devices.

参数

-v
Verbose mode
-w
Destructive write test (erases data)
-n
Non-destructive read-write test
-s
Show progress
-o _file_
Output bad blocks to file
-b _size_
Block size in bytes (default: 1024)
-c _blocks_
Number of blocks to test at once (default: 64)
-p _passes_
Number of test passes (default: 0, meaning single pass)
-t _pattern_
Test pattern (use `random` for random data, or a numeric value 0-255)
-i _file_
Read existing bad blocks list from file (skip retesting known blocks)
-f
Force testing on a mounted device (dangerous, normally prevented)

FAQ

What is the badblocks command used for?

badblocks searches a device for bad blocks by performing read, write, or non-destructive read-write tests. It's used to verify disk integrity and create lists of bad blocks for filesystem tools. The tool is particularly useful for testing new drives or diagnosing failing storage devices.

How do I run a basic badblocks example?

Run `badblocks -v [/dev/sdb]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -v do in badblocks?

Verbose mode