Skip to content

Instantly share code, notes, and snippets.

@meinside
Last active March 20, 2024 21:26
Show Gist options
  • Star 35 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save meinside/0538087cc60a2f0654bb to your computer and use it in GitHub Desktop.
Save meinside/0538087cc60a2f0654bb to your computer and use it in GitHub Desktop.
For checking health of usb hdd on raspberry pi with smartctl.

for testing external hdd with smartctl,

install smartmontools

$ sudo apt-get install smartmontools

start test,

#$ sudo smartctl -t short -d sat /dev/sda
$ sudo smartctl -t long -d sat /dev/sda -T permissive

then it will say

Testing has begun.
Please wait 100 minutes for test to complete.
Test will complete after Thu Oct  6 11:36:22 2016

so wait for it...

After its completion,

$ sudo smartctl -l selftest -d sat /dev/sda -T permissive

to see the test result.

@eljojo
Copy link

eljojo commented Dec 28, 2020

thanks! I was missing this and found it through google. I was missing -d sat

@stevleibelt
Copy link

Thank you too

@trevordavies095
Copy link

Thanks!

@Eneskrassbaraa
Copy link

Is it possible to run this command twice (for two harddrives) like a queue? Thank you!

@KBTasc
Copy link

KBTasc commented Feb 12, 2024

How do you use this on NVME drives?
"sudo smartctl -t long -d sat /dev/nvme0 -T permissive"
Is accepted as command however "Read Device Identity failed: Inappropriate ioctl for device"
error is shown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment