Skip to content

feat: space limit per Mac - Time Machine quota plus an alarm on Drive usage - #17

Merged
mbeczynski merged 1 commit into
mainfrom
feat/space-limit
Oct 6, 2026
Merged

mbeczynski merged 1 commit into
mainfrom
feat/space-limit

Conversation

@mbeczynski

Copy link
Copy Markdown
Contributor

Until now limit_gb in machines.json was read but did nothing. The README called this "Per-machine budgets are not enforced".

How it works

  • Setting it: the Space limit for this Mac card in the window, or cloudmachine-agent set-limit --gb N. It is stored in machines.json under this Mac's Drive folder; the other Macs' entries are kept.
  • Time Machine quota: the app gives a 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.
  • Alarm: the watchdog measures this Mac's folder (rclone size, measured here at 51 s and ~20 API calls) at most every 6 hours. It reports drive-budget-near from 90% and drive-budget-exceeded above 100%. Nothing is deleted by it.
  • Visibility: the window and drive-status (Space limit:) show usage against the limit and the quota command while the quota does not match.
  • Safety: an unreadable machines.json is never overwritten.

Checks

  • swift test 341/0, lint passes.
  • rclone size --json was checked on real data: 18,860 files, 632,419,437,550 B. The format matches the parser.
  • drive-status and set-limit --help were 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

… 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>
@mbeczynski
mbeczynski merged commit af7c64b into main Oct 6, 2026
2 checks passed
@mbeczynski
mbeczynski deleted the feat/space-limit branch October 6, 2026 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant