Page 1 of 1

Check USB stick for physical health: badblocks

Posted: Mon Jan 02, 2023 12:13 am
by ^rooker
This is merely a short writedown of something I always forget for years now:
(Should work on most GNU/Linux distros, but I've usually used it on Debian-flavored ones (eg Xubuntu))

Assuming the to-be-checked storage media (eg USB-Stick, HDD, etc) has the physical device name of "/dev/sdX" (eg "/dev/sdc1")

Code: Select all

$ badblocks -nsv -o badblocks_list.log /dev/sdX
-n: non-destructive read-write test (Can be used on storage that already contains data)
-s: show progress
-v: verbose


Output while checking looks like this:
Checking for bad blocks in non-destructive read-write mode
From block 0 to 59055103
Checking for bad blocks (non-destructive read-write test)
Testing with random pattern: 2.97% done, 4:04 elapsed. (0/0/0 errors)

8)