S.M.A.R.T.

From David's Wiki
Revision as of 14:43, 10 March 2023 by David (talk | contribs) (→‎Long Smart Tests)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
\( \newcommand{\P}[]{\unicode{xB6}} \newcommand{\AA}[]{\unicode{x212B}} \newcommand{\empty}[]{\emptyset} \newcommand{\O}[]{\emptyset} \newcommand{\Alpha}[]{Α} \newcommand{\Beta}[]{Β} \newcommand{\Epsilon}[]{Ε} \newcommand{\Iota}[]{Ι} \newcommand{\Kappa}[]{Κ} \newcommand{\Rho}[]{Ρ} \newcommand{\Tau}[]{Τ} \newcommand{\Zeta}[]{Ζ} \newcommand{\Mu}[]{\unicode{x039C}} \newcommand{\Chi}[]{Χ} \newcommand{\Eta}[]{\unicode{x0397}} \newcommand{\Nu}[]{\unicode{x039D}} \newcommand{\Omicron}[]{\unicode{x039F}} \DeclareMathOperator{\sgn}{sgn} \def\oiint{\mathop{\vcenter{\mathchoice{\huge\unicode{x222F}\,}{\unicode{x222F}}{\unicode{x222F}}{\unicode{x222F}}}\,}\nolimits} \def\oiiint{\mathop{\vcenter{\mathchoice{\huge\unicode{x2230}\,}{\unicode{x2230}}{\unicode{x2230}}{\unicode{x2230}}}\,}\nolimits} \)

SMART Testing

smartctl

USB Hard Drives

  • Add -d sat

Seagate USB Hard Drives

For Seagate USB hard drives, it will run in uas mode and smart won't work.
See https://askubuntu.com/questions/637450/cannot-perform-smart-data-and-self-test-on-external-hard-drive.
To fix this:

  1. Run lsusb to find the id of your HDD
    • It should start with 0bc2.
  2. Create file /etc/modprobe.d/ignore_uas.conf and add this following:
    • options usb-storage quirks=[ids]
    • E.g. options usb-storage quirks=0bc2:ab31:,0bc2:a0a4:
  3. Run sudo update-initramfs -u
  4. Reboot

Long Smart Tests

When running long smart tests, you will want to continuously poll the device so it does not go to sleep.

DEVICE=/dev/sda
sudo smartctl -t long $DEVICE
sudo watch -d--cumulative -n 10 smartctl -l selftest $DEVICE

Remote monitoring

See Reference

  1. Install the following:
    sudo apt install mailutils msmtp msmtp-mta smartmontools
  2. Edit /etc/smartd.conf
  3. Add some options

See smartd.conf reference

Example:

/dev/disk/by-id/usb-WD_easystore_264D_394B47573334314C-0:0 -s (S/../../6/01) -a -m [email protected] -M test -M daily
  • -a turns on some defaults for checking smart attributes
  • -M Test sends a test email when smartd starts
  • -M daily sends daily reminders for failures
  • -s (S/../../6/01) runs a short test every saturday at 1AM.

Tests

sudo smartctl -t <short|long|conveyance|select> <drive>
  • conveyance is good to test after any physical movement of the drive.

gsmartcontrol

gsmartcontrol is a GUI frontend for smartctl