Disk check
Bad blocks
badblocks is used to search for bad blocks on a device. It can be installed on NetBSD with:
pkgin install e2fsprogs
or on macOS with:
brew install e2fsprogs
A test can be launched by executing the following command:
# Device must first be unmounted on macOS
sudo diskutil unmountDisk /dev/<device>
badblocks -n -s -v /dev/<device>
where <device> can be identified by executing:
dmesg | tail
right after plugging in the USB flash storage on GNU/Linux or NetBSD and
diskutil list
on macOS.