Skip to content

Instantly share code, notes, and snippets.

@troyfontaine
Last active March 24, 2022 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save troyfontaine/593bd40d30c10091d5cde491eb33adc7 to your computer and use it in GitHub Desktop.
Save troyfontaine/593bd40d30c10091d5cde491eb33adc7 to your computer and use it in GitHub Desktop.
Running Badblocks on External USB Drives attached to a TrueNAS Scale Machine

Badblocks on TrueNAS Scale

  1. Connect your USB drive to the machine
  2. Navigate to the TrueNAS Scale shell by opening the menu, going to System Settings and then clicking on Shell
  3. Locate the drive's device ID using the lsblk command
  4. Check the recommended block size using the command blockdev --getbsz /dev/<YOUR BLOCK DEVICE ID>
  5. Note the block size you got from the last command
  6. STOP! Have you ensured that the USB device does NOT have any important data on it? If it does, stop now, unplug it from the TrueNAS Scale machine and back it up elsewhere! Running the specific badblocks command we'll use will destroy data on the drive!
  7. Okay, you've confirmed there is no data on the drive you need? Good!
  8. Fire up a new tmux session tmux new -s badblocks_<YOUR BLOCK DEVICE ID>
  9. Run the command badblocks -t random -w -s -b <YOUR BLOCKSIZE GOES HERE> /dev/<YOUR BLOCK DEVICE ID>
  10. Disconnect from the session by pressing CTRL+b then d
  11. Reconnect to the session to check on it by using tmux attach-session -t badblocks_<YOUR BLOCK DEVICE ID>
  12. Wait for it to finish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment