Fixes Linux drive letter shifting (/dev/sda .. /dev/sdz) breaking Munin's smart_ wildcard plugin, eliminates dmesg Sense Key errors caused by non-ATA devices (e.g. STEC ZeusRAM NVRAM SLOGs), and provides non-destructive RRD telemetry migration on the Munin master.
In the Linux kernel SCSI subsystem (drivers/scsi/sd.c), drive letters (sda, sdb, ..., sdz) are assigned on a first-come, first-served basis as SCSI targets report TEST UNIT READY.
On systems with:
- Multiple SAS/SATA HBAs (e.g., dual Broadcom/LSI SAS3008
mpt3sascontrollers), - Mixed storage media (spinning HDDs with spin-up delays vs. instant-on NVMe/SATA SSDs),
- SAS expanders & hot-swap bays (where drives are discovered asynchronously or hot-plugged),
...drive letters inevitably shift across reboots or after drive replacements.
Munin conventionally uses symlinks matching kernel drive letters:
/etc/munin/plugins/smart_sda -> /usr/share/munin/plugins/smart_
/etc/munin/plugins/smart_sdb -> /usr/share/munin/plugins/smart_When drive letters shuffle across reboots:
- Telemetry Corruption: On Day 1,
smart_sdagraphs a 4TB mechanical HDD (tracking spin-up time and load cycles). On Day 2 after a reboot,smart_sdapoints to a fast SSD (tracking wear indicators and NAND writes). The historical RRD graphs on the Munin master mix two completely different devices. dmesgSense Key Flood from Non-ATA Devices: Enterprise SAS devices such as STEC ZeusRAM SLOGs or hardware RAID units adhere to SPC-4 SAS and do not implement standard ATA attribute tables. When Munin queries them viasmartctl -a -A -i, the device firmware returnsSense Key : Recovered Error(ASC=0x80 ASCQ=0x0). The Linux SCSI driver logs this todmesgevery 5 minutes.- Unmonitored Disks: If an admin manually unlinks
smart_sdpto silence the ZeusRAM noise, a subsequent reboot may assignsdpto a real mechanical drive—leaving that drive completely unmonitored while ZeusRAM continues to be polled under a newly assigned letter likesdn.
Munin's standard Python smart_ plugin natively supports persistent device identifiers:
def guess_full_path(hard_drive):
for dev_dir in ('/dev', '/dev/disk/by-id'):
full_path = os.path.join(dev_dir, hard_drive)
if os.path.exists(full_path):
return full_path
return NoneBy pointing Munin symlinks directly to udev's persistent /dev/disk/by-id/ata-* symlinks:
ln -s /usr/share/munin/plugins/smart_ \
/etc/munin/plugins/smart_ata-WDC_WD40EFRX-68N32N0_WD-WCC7K6PP5S13- Reboot Invariance: Udev automatically updates the symlink target. Munin graphs on the master (
<host>-smart_ata_<model>_<serial>-<metric>-g.rrd) are permanently anchored to the physical drive serial number forever. - Automatic Exclusion of Non-ATA Devices: Exotic SAS devices (like ZeusRAM) are registered under
scsi-*orwwn-*, neverata-*. They are naturally excluded from ATA SMART polling.
munin-reconcile-smart.sh: Boot-time reconciliation script deployed to/usr/local/sbin/munin-reconcile-smart. Scans/dev/disk/by-id/ata-*, ensures persistent links exist, prunes dead links, and purges volatilesmart_sd*symlinks.munin-reconcile-smart.service: Systemd oneshot unit deployed to/etc/systemd/system/and orderedBefore=munin-node.service.migrate_munin_smart_rrds.py: Orchestration script to run on the Munin master or client. Backs up legacy RRD files and renames them to match the new sanitizedsmart_ata_*names without losing multi-year telemetry.
# 1. Install script
sudo cp munin-reconcile-smart.sh /usr/local/sbin/munin-reconcile-smart
sudo chmod +x /usr/local/sbin/munin-reconcile-smart
# 2. Install systemd unit
sudo cp munin-reconcile-smart.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable munin-reconcile-smart.service
# 3. Run initial reconciliation and restart munin-node
sudo /usr/local/sbin/munin-reconcile-smart
sudo systemctl restart munin-nodeIf you already have historical RRD files on the Munin master:
# Preview proposed renames (dry-run):
python3 migrate_munin_smart_rrds.py --node-host <node_ip_or_hostname> --munin-master <master_host>
# Apply renames with automatic backup:
python3 migrate_munin_smart_rrds.py --node-host <node_ip_or_hostname> --munin-master <master_host> --applyOn the next 5-minute poll, Munin master will detect the persistent smart_ata_* plugins, find the renamed RRD files, and seamlessly continue appending data points without a gap.