A Linux utility for detecting bad sectors, bad blocks, and bad zones on host-managed SMR (Shingled Magnetic Recording) drives and other zoned block devices.
- Detects bad sectors and zones by performing read tests
- Supports host-managed SMR drives using the Linux zoned block device API
- Uses direct I/O (O_DIRECT) for accurate hardware access
- Configurable zone range and read block size
- Real-time progress display with read speed statistics
- Graceful interruption via Ctrl+C
- Detailed summary with zone statistics and error counts
- Linux kernel with zoned block device support
- Linux kernel headers (
linux/blkzoned.h,linux/fs.h) - GCC compiler
- Root privileges (required for direct device access)
makesudo make installThis installs:
badzonesbinary to/usr/local/bin- Man page to
/usr/local/share/man/man1
To uninstall:
sudo make uninstallbadzones [options] <device>
| Option | Long Option | Description |
|---|---|---|
-s <zone> |
--start <zone> |
Start from zone number (default: 0) |
-e <zone> |
--end <zone> |
End at zone number (default: last zone) |
-b <size> |
--block <size> |
Read block size in bytes (default: zone size, max 256M) |
-v |
--verbose |
Show info for each zone |
-E |
--read-empty |
Also read empty sequential zones |
-a |
--all |
Show all zone info (implies -v) |
-h |
--help |
Show help message |
Check all zones on a device:
sudo badzones /dev/sdaCheck a specific range of zones:
sudo badzones -s 100 -e 200 /dev/sdaVerbose output showing each zone:
sudo badzones -v /dev/sdaShow all zone information:
sudo badzones -a /dev/sdaPress Ctrl+C to stop gracefully. The program will finish checking the current zone and display a summary of results.
| Code | Description |
|---|---|
| 0 | Success - no errors detected |
| 1 | Error - failed to open device or other runtime error |
| 2 | Errors detected - bad zones or read errors found |
| 3 | Interrupted - check was stopped by user |
This project is licensed under the GNU General Public License v2.0 or later. See the LICENSE file for details.
PlayerCatboy me@ralf.ren