Repository navigation
feat: space limit per Mac - Time Machine quota plus an alarm on Drive usage - #17
Merged
Merged
Conversation
… usage `limit_gb` in machines.json was read and never used, while several Macs on one Google account share its space. Now each Mac can have a limit (window card or `cloudmachine-agent set-limit --gb N`), stored under its Drive folder in machines.json, and it acts two ways: - Time Machine quota: the app offers `sudo tmutil setquota <id> <GB>` (root is required) at 70% of the limit, because the image on Drive is larger than the backup inside it (417 GiB of data in 589 GiB of bands, 29 Sep). Time Machine then deletes the oldest backups to stay under it. - Alarm: the watchdog measures this Mac's folder with `rclone size` (51 s, ~20 API calls, so at most every 6 hours) and reports `drive-budget-near` from 90% and `drive-budget-exceeded` above 100%. Nothing is deleted. The window and `drive-status` show usage against the limit and the quota command while the quota does not match. A machines.json that cannot be read is never overwritten. 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.
Until now
limit_gbinmachines.jsonwas read but did nothing. The README called this "Per-machine budgets are not enforced".How it works
cloudmachine-agent set-limit --gb N. It is stored inmachines.jsonunder this Mac's Drive folder; the other Macs' entries are kept.sudo tmutil setquota <id> <GB>command to copy, because it needs root. The quota is 70% of the limit: the image on Drive is about a third larger than the backup inside it (417 GiB of data in 589 GiB of bands on 29 Sep). TM then deletes the oldest backups to stay under it.rclone size, measured here at 51 s and ~20 API calls) at most every 6 hours. It reportsdrive-budget-nearfrom 90% anddrive-budget-exceededabove 100%. Nothing is deleted by it.drive-status(Space limit:) show usage against the limit and the quota command while the quota does not match.machines.jsonis never overwritten.Checks
swift test341/0, lint passes.rclone size --jsonwas checked on real data: 18,860 files, 632,419,437,550 B. The format matches the parser.drive-statusandset-limit --helpwere checked in both languages.README: the last limitation besides notarisation is gone; there is a Space limit per Mac section instead.
Merging releases a new version automatically.
🤖 Generated with Claude Code