Forrest logo
tool overview
On this page you find all important commands for the CLI tool badblocks. If the command you are looking for is missing please ask our AI.

badblocks

The badblocks command line tool is a utility used in Linux and Unix-based systems to scan for and detect bad blocks on storage devices such as hard drives and solid-state drives (SSDs). Bad blocks refer to damaged or faulty sectors on a storage device that may contain corrupt data or may not function properly.

By using badblocks, users can identify and isolate these problematic blocks before they become a significant issue. The tool reads and writes various patterns of data to disk sectors and compares the results to identify blocks that are not functioning correctly. It performs thorough testing and provides information on the number and location of bad blocks on the device.

The badblocks command usually requires the user to specify the device to be checked, and it can be run in read-only mode to check for bad blocks without altering the data on the drive. It can also be used in combination with other Linux tools, such as fsck (file system check), to check and repair file systems by marking the detected bad blocks.

Overall, badblocks is a valuable command line tool to identify and manage the health of storage devices, ensuring data integrity and preventing potential data loss caused by faulty blocks.

List of commands for badblocks:

  • badblocks:tldr:2b3ad badblocks: Search an unmounted disk in destructive mode and output found blocks to a file.
    $ sudo badblocks -o ${filename} -w ${-dev-sdX}
    try on your machine
    explain this command
  • badblocks:tldr:55abf badblocks: Search an unmounted disk in destructive mode with improved speed using 4K block size and 64K block count.
    $ sudo badblocks -w -b ${4096} -c ${65536} ${-dev-sdX}
    try on your machine
    explain this command
  • badblocks:tldr:6cb2f badblocks: Search a disk for bad blocks by using a non-destructive read-only test.
    $ sudo badblocks ${-dev-sdX}
    try on your machine
    explain this command
  • badblocks:tldr:6d512 badblocks: Search an unmounted disk for bad blocks with a destructive write test.
    $ sudo badblocks -w ${-dev-sdX}
    try on your machine
    explain this command
  • badblocks:tldr:89d11 badblocks: Search an unmounted disk for bad blocks with a destructive write test and show verbose status.
    $ sudo badblocks -svw ${-dev-sdX}
    try on your machine
    explain this command
  • badblocks:tldr:c8b78 badblocks: Search an unmounted disk for bad blocks with a non-destructive read-write test.
    $ sudo badblocks -n ${-dev-sdX}
    try on your machine
    explain this command
tool overview