The following is the GNU All-permissive License as recommended in https://www.gnu.org/licenses/license-recommendations.en.html

Copyright (C) 2024 Free Software Foundation sysadmin@fsf.org

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.

Contributions are welcome. See https://savannah.gnu.org/maintenance/fsf/.

badblocks

-b 4194304 (4 MB) is for ssd. remove it for hdd. Reference: https://unix.stackexchange.com/questions/93686/can-i-prove-that-an-ssd-is-broken

For a long read / write test (4 r/w passes):

badblocks -svw -b 4194304 /dev/sdX

For a single fast r/w pass of random data:

badblocks -svw -b 4194304 -t random /dev/sdX