Make the SMB deadtime configurable - #298
Closed
artem-from-ua wants to merge 2 commits into
Closed
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Owner
|
I just set it larger. We need a cleanup more than once per day, but we don't need it super often. |
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.
Summary
deadtimeis hard-coded to 15 minutes in the generatedsmb.conf. On a Time Machine target that value works against the device: the share can sit idle/standby even between hourly backups, at the momentsmbdtears the session down every 15 minutes, and macOS re-establishes it immediately, re-running session setup, tree connect and durable handle negotiation each time — on hardware where that path is already fragile.This adds
TC_SMB_DEADTIME, plumbed the same way asTC_ATA_IDLE_SECONDS/TC_ATA_STANDBY, with a default of 60 minutes.0disables the idle disconnect entirely.Environment
173fc60("docs(faq): explain reusing existing Time Machine backups")Why the 15m value is not optimal here
The 15-minute value came in with
2ccff2b("Tune Samba defaults for lower Time Capsule resource usage"), where trimming idle sessions was part of keeping resource use down. With the configuration as it stands now — and more so if #297 lands — that trade-off no longer pays for itself: the disconnects free nothing worth reclaiming, while the reconnects they cause keep waking the capsule's disk.The concrete case is Spotlight. It keeps a session on the share that is idle for long stretches but reconnects on its own, so a 15-minute
deadtimeproduces a disconnect/reconnect cycle indefinitely rather than freeing anything. Indexing cannot be turned off to avoid this — per Apple's own documentation, "this indexing is necessary for Time Machine to function properly and can't be disabled", and those who forced it off at the command line found that Time Machine backups stopped along with it (The Eclectic Light Company, "You cannot turn off Spotlight indexing on your Time Machine backup", citing Apple KB PH18794). The volume is also mounted more than once under/Volumes/.timemachine/(Time Machine and Spotlight mount it separately, under different spellings of the host), so each mount is a session of its own that the timer tears down independently.That is not just a reconnect cost. Each disconnect/reconnect wakes the disk, so the drive can never stay in IDLE or STANDBY for longer than
deadtimeminus the ATA timer — withdeadtime = 15andTC_ATA_IDLE_SECONDS = 300that leaves roughly ten minutes of quiet before the next wake-up restarts the countdown. A shortdeadtimetherefore puts a ceiling on how long the disk can stay spun down, which is the opposite of what the resource-saving intent was after. The reconnect itself is not free either: each one re-runs session setup, tree connect and durable handle negotiation, and during one incident here a reconnect loop firing every ~15 s wedgedsmbdoutright under Time Machine write load.Changes
44 files, +335/−7, in two commits:
Make the SMB deadtime configurable—TC_SMB_DEADTIMEthroughcore/config.py(defaults, env keys, validator, both validated-key tuples),services/configure.py,services/deploy.py,app/ops/, telemetry option keys, and the runtime shell: default and sanitisation in00-env-log.sh, substitution in thesmb.confheredoc, and the value added totc_manager_samba_config_signatureso a changed setting actually triggers a regenerate.Add the SMB deadtime setting to the macOS app— profile model with migration for existing profiles, editor validation, both settings panes, deploy/configure params, diagnostics, and the four localization keys across all ten languages.Hidden
configureflag, matching--ata-idle-seconds:Verified
ruffcleansmb.confand an invalid value falling back to 60 with a warningdeadtime = 480in the generatedsmb.conf, and the setting is visible and editable in the app's Settings pane