[smartmontools-support] smartd settings per disk type

Orsiris de Jong ozy at netpower.fr
Wed Jun 5 17:10:06 CEST 2019


I'm currently (re)developping a Python GUI for smartd, that works with Windows and Linux.

I would like to be able to create different smartd configuration profiles depending on the disk type (ie: spinning disks, ssd, nvme & removable is the most common usecase).
So far, from what I've understood from smartd.conf(5) manual page, I can use the follwing to specify different settings depending on disks:

DEVICESCAN -d nvme [various settings for nvme disks]
DEVICESCAN -d removable [various settins for usb / other removable disks]

My problem is to identify spinning disks and SSD disks, which simply look like SCSI devices on most modern computers.

I can workaround by making something like the following pseudo code:
for device in smartctl --scan:
    disk_type = grep "Rotation rate" device

The upper would give me a list of /dev/xxx with it's type, which I then can feed smartd.conf with instead of DEVICESCAN lines like:

# spinning disks
/dev/sda [various settings for spinning disks]
/dev/sdb [various settings for spinning disks]
# ssd disks
/dev/sdd [various settings for ssd disks]
# nvme disks
DEVICESCAN -d nvme [various settings for nvme disks]

This solution isn't the best because it's not dynamic, ie once the smartd.conf file is written, it will stay that way until the pseudo code above is executed again, evzn if the disk labels change.

Is there any better solution I may use ?

Also, I've read that the -d removable option is experimental. With which version was it implemented so I don't break things with elder smartmontools releases ?

My goal is to achieve the underlying code to this GUI part, in the least "ugly" way:

Best regards.

Orsiris de Jong
Tél: 06 75 40 48 41

More information about the Smartmontools-support mailing list