Repository navigation
feat(smart): key SMART series on the port a drive is cabled to, not its letter (#745) - #759
Merged
Merged
Conversation
…ts letter (#745) smaug's boot SSD was sdc, then sdb, on two boots on 2026-09-29 with no disk moved, and SmartDriveBadSectors paged on its recorded four each time because the baseline row named the old letter. It paged again on 2026-09-30. The collector now puts `slot` on every per-device series: the drive's /dev/disk/by-path name (shortest spelling, then sort order), with `:cciss,N` behind a Smart Array, and the device label where there is no by-path name. The baseline is keyed on host + slot, and the rule joins on(host, slot). A series from a collector older than this has no slot, so the rule gives it its device as the slot, and oracle's row still names /dev/sda. It also fixes a second letter bug: SmartDriveBadSectorsGrowing matched a series to itself a week earlier by letter, so a drive with 4 sectors landing on a letter that held 0 would have read as growth. ADR-0066 records the decision, superseding ADR-0046's device key. Tests cover a letter move against one row (quiet), a row still naming a letter (loud), the Growing rule across a move (quiet), and by_path_of's choice between spellings. Closes #745 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #745, taking the issue's option 2 (by-path). The decision is recorded as ADR-0066, which supersedes ADR-0046's
devicekey.Why
smaug's boot SSD wassdc, thensdb, on two boots on 2026-09-29, with no disk moved.SmartDriveBadSectorspaged on its recorded 4 sectors each time, and again on 2026-09-30, because the baseline row named the old letter.What changes
collect-smart-state.sh: every per-device series gains aslotlabel, the drive's/dev/disk/by-pathname.ata-6andata-6.0), the shortest wins.…:cciss,N.render-smart-baselines.sh: rows are keyed onhost+slot.smaug's row ispci-0000:00:17.0-ata-6.SmartDriveBadSectors: joinson(host, slot). A series with noslot, from a collector older than this (oracle's installed copy), uses itsdeviceas the slot. Sooracle's row still names/dev/sda, and the rollout order between hosts doesn't matter fororacle.SmartDriveBadSectorsGrowingsubtracts each series from its value a week earlier, matched by labels, and the letter was one of those labels. A drive with 4 sectors landing on a letter that held 0 would have read as growth of 4. Withslotin the label set, a moved letter is a new series with no week-old point.Tests
host.test.yaml:sdctosdbagainst one row: quiet.Growingacross a letter move: quiet.oraclecases now carry thedevicefallback.collect-smart-state.sh --self-test: the slot survives a letter move and rides the model-labelled series, andby_path_ofpicks the shorter spelling and ignores partitions. 28/28 pass locally.check_docs.pypasses.promtool test rulescould not run locally (no promtool or Docker on this Windows machine), so CI's Validate configs is its first run.Needs before merge
pci-0000:00:17.0-ata-6 -> ../../sdb, with anata-N.0spelling beside every disk, so the shortest-spelling rule picksata-6. Originally:pci-0000:00:17.0-ata-6is inferred from the S3520 being onata6of the00:17.0AHCI. On smaug:ls -l /dev/disk/by-path/ | grep -v part.Deploy order after merge
collect-smart-state.shinto/mnt/erebor/apps/stackand run the cron command once. Its series then carryslot. The rule in force until step 2 still joins ondevice, so nothing pages in between.git pull && sudo make smart-state, and reload the rules.Doing step 2 first would page for smaug until step 1 runs.
oracleneeds nothing now. When its collector is next reinstalled, its row changes to the slot--printshows.Known consequence
SmartDriveUnsafeShutdownsGrowingstayed quiet on 2026-09-29 only because the letter moved. With a stable key it will fire on smaug's planned reboots, because the S3520 counts a clean shutdown as unsafe (hardware.md). That's #574's problem, and this PR exposes it rather than causes it.🤖 Generated with Claude Code