@Mark_Stevens and @underpickled , I shared a detailed post here requesting some input related to the phantom disk/cronjob errors as I believe it is a separate topic: Smartctl Error, Phantom Disk, and Cronjob Errors Introduced in 25.10 and Following
I am experimenting with this:
/usr/sbin/smartctl -t short /dev/disk/by-id/SEE BELOW
or
/usr/sbin/smartctl -t long /dev/disk/by-id/SEE BELOW
Check the progress/result:
/usr/sbin/smartctl -l selftest /dev/disk/by-id/SEE BELOW
Command: /usr/sbin/smartctl -t short /dev/sdX
Important Notes:
Replace /dev/sdX: Make sure you replace /dev/sdX with your actual drive identifier (e.g., /dev/sda, /dev/sdb). You can run lsblk or fdisk -l to see which drive is which.
Scheduling Warning: If you are putting this into a Cron Job, do not use /dev/sda, etc. Drive letters can change (e.g., sda becomes sdb) if you reboot or change cables.
Better for Cron: Use the disk ID.
Run ls -l /dev/disk/by-id/ to find the long name (e.g., ata-WDC_WD100...).
Your command becomes: /usr/sbin/smartctl -t short /dev/disk/by-id/ata-YOUR_DRIVE_ID
How to see the results
The test runs in the background (usually takes 2 minutes). To see the results afterward, run:Bash
smartctl -l selftest /dev/sdX
In cron as root:
S.M.A.R.T. Test long ALL HD(SSDs/NVMe drives excluded, unnecessary wear or stress.)
for d in /dev/sd[a-z]; do smartctl -i “$d” | grep -q “Solid State” || (echo “Testing $d…” && smartctl -t long “$d”); done
S.M.A.R.T. Test short ALL
for d in $(smartctl --scan | awk ‘{print $1}’); do smartctl -t short “$d”; done
Results check:
for d in $(smartctl --scan | awk ‘{print $1}’); do echo -n "$d: "; smartctl -l selftest “$d”; done
for d in $(smartctl --scan | awk ‘{print $1}’); do echo -n "$d: "; smartctl -l selftest “$d” | awk ‘/^# [0-9]+/ {print $2, $3, $4, $5, $6; exit}’; done