Skip to content

Instantly share code, notes, and snippets.

@mdPlusPlus
Last active July 20, 2026 10:59
Show Gist options
  • Select an option

  • Save mdPlusPlus/30ebddea8d6167b27ef2d07c75e5ebc9 to your computer and use it in GitHub Desktop.

Select an option

Save mdPlusPlus/30ebddea8d6167b27ef2d07c75e5ebc9 to your computer and use it in GitHub Desktop.
How to check new hard drives with badblocks
badblocks -b 4096 -p 0 -s -t 0 -v -w DEVICE [LAST_BLOCK] [FIRST_BLOCK]
-b block_size (4096 only works up to 16TiB drives, consider using 8192 for up to 32TiB, or 16384 for up to 64TiB. Default is 1024)
-c Number of blocks which are tested at a time (Default is 64, consider increasing to speed up the process, 64*4096B=256KiB)
-p num_passes
-s Show the progress of the scan
-t test_pattern
-v Verbose mode
-w Use write-mode test
@mdPlusPlus

mdPlusPlus commented Mar 16, 2025

Copy link
Copy Markdown
Author

Shows output similar to this: Checking blocks 0 to 1953512447
When cancelled with ctrl+c: Interrupted at block 284489984
To continue: badblocks -b 4096 -p 0 -s -t 0 -v -w DEVICE 1953512447 284489983

@mdPlusPlus

Copy link
Copy Markdown
Author

A more modern equivalent would look like this:
badblocks -b 16384 -c 512 -p 0 -s -t 0 -v -w DEVICE [LAST_BLOCK] [FIRST_BLOCK]

It writes/reads 512 blocks of 16KiB (so 8MiB) at a time on drives with a capacity of up to 64TiB).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment