Skip to content

vm: kopia metadanych obrazu na Drive, alarm limitu Google, pomiar zajętości, docs tapu - #34

Merged
mbeczynski merged 5 commits into
mainfrom
feat/vm-tm-meta-sync
Oct 27, 2026
Merged

mbeczynski merged 5 commits into
mainfrom
feat/vm-tm-meta-sync

Conversation

@mbeczynski

Copy link
Copy Markdown
Contributor

Kontynuacja #32/#33 (sesja 27.10.2026, wieczór).

Co

  • tm-meta-sync (vm/systemd/tm-meta-sync.service + .timer, co 15 min, w szablonie): rclone sync /srv/tm-local/ ${CM_REMOTE}-meta/ bez */bands/** i */lock. Bez tego Info.plist/token/mapped/ obrazu były tylko na dysku maszyny (wykluczonym z TM) i pasm na Drive nie dało się otworzyć. ExecCondition nie puszcza synchronizacji z obrazu bez Info.plist (nowa maszyna przed odtworzeniem skasowałaby kopię). Znacznik /var/lib/cloudmachine/tm-meta-sync.ok po każdym sukcesie.
  • VMLayout.services + tm-meta-sync.timer (unitName() - vm-setup startował <nazwa>.service), vm-status pokazuje wiek kopii metadanych, vm-status i backup-health alarmują po >1 h (odroczone w oknie startu).
  • Limit 750 GB/dobę: rclone 1.75.1 ponawia każdą wysyłkę co ≤5 min i wznawia sam, ale nic tego nie zgłaszało (erroredFiles dotyczy czyszczenia cache), a TM kończył kopie „z sukcesem” do bufora. Status czyta koniec logu rclone: odmowa nowsza niż ostatnia udana wysyłka = limit trwa. vm-status + backup-health (drive-upload-limit).
  • vm-guard --dry-run: decyzje strażnika dla każdego stanu TM bez działania (TM jest globalny - strażnik na cmtest zatrzymałby żywą kopię).
  • Pomiar zajętości: zapisany odczyt pamięta zmierzony folder; odczyt innego folderu (101 MB z 14:31, sprzed przejścia na -tm) jest mierzony od nowa zamiast pokazywany obok 215 GiB.
  • vm-setup: limactl start --timeout 50m - pierwszy rozruch nowej maszyny trwał 30 min (sudo -iu root Limy przy każdym pliku mode: data, pam_systemd czeka 2 min w trakcie cloud-final), domyślne 10 min kończyło vm-setup błędem. Kolejne rozruchy ~12 s.
  • README + packaging/README: tap Homebrew aktualizuje się sam (bypass renacode-tap od 27.10, 1.3.15 weszło samo); ręczny PR tylko jako obejście.

Testy

  • swift test: 305 zielonych; swift-format lint --strict czysto. systemd-analyze verify jednostek w maszynie: OK.
  • Jednorazowa maszyna cmtest (gdrive:CloudMachine/test-vm-tm) z tej gałęzi:
    • tm-meta-sync: kopia na -tm-meta, znacznik; vm-status stany świeża / ZALEGŁA (rc 1) / NIGDY; backup-health --quiet zgłasza i gasi alarm.
    • odtworzenie wg vm/README: obraz 2 GB + plik 300 MB, pasma i meta na Drive, limactl delete cmtest, nowa maszyna, kroki z README, hdiutil attach -readonly - SHA-256 pliku identyczne.
    • limit: sztuczna linia Received upload limit error w logu → vm-status/backup-health zgłaszają, po udanej wysyłce gaśnie. Odcięcie 443 w maszynie: kolejka 47 pasm rośnie, --dry-run = pause; po przywróceniu sieci rclone dosłał wszystko sam w ~1 min bez restartu, --dry-run = resume. Uwaga: odcięta sieć to nie 403 Google - 8 wysyłek wisiało 47 min na zerwanych połączeniach (do osobnej analizy).

Poza zakresem

  • Żywa cmsmb to prototyp (jednostki na sztywno, bez vm.env/bundle.env, bez smbd.service.d/cloudmachine.conf) - przepięcie osobno, za zgodą.
  • Lima osadza pliki szablonu w ~/.lima/<maszyna>/lima.yaml przy tworzeniu; nowy szablon z wydania NIE trafia do istniejącej maszyny (komentarz w cmsmb.yaml mówi inaczej) - do osobnego PR (vm-update).

🤖 Generated with Claude Code

https://claude.ai/code/session_01AU1MhxJW1e9oTB2XvjX8WT

mbeczynski and others added 5 commits October 27, 2026 18:27
…tale

The bands on Drive cannot be opened without the image's Info.plist, token
and mapped/, which lived only on the machine's disk - kept out of Time
Machine. tm-meta-sync (service + 15 min timer) copies /srv/tm-local minus
bands/ and lock to <folder>-tm-meta, never from an image without its
Info.plist (rclone sync would wipe the copy), and stamps each success.

vm-status shows the copy's age; it and backup-health report one older than
an hour (deferred after startup). vm/README gains the restore procedure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AU1MhxJW1e9oTB2XvjX8WT
…sured

The 14:31 reading (101 MB, before the move to <folder>-tm) was still shown
at 18:00 while the folder held 215 GiB: younger than six hours, it was never
measured again. Readings now carry their folder; another folder's reading,
or one stored before this change, is measured again instead of shown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AU1MhxJW1e9oTB2XvjX8WT
renacode-tap is on the bypass list of homebrew-tap's main ruleset since
2026-10-27 and 1.3.15 reached the tap on its own. The hand-made pull
request is now only the workaround for a failed push.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AU1MhxJW1e9oTB2XvjX8WT
At the 750 GB limit rclone's write-back retries every upload, at most
5 min apart, and resumes by itself (rclone 1.75.1 vfs/vfscache/writeback) -
but nothing reported it: erroredFiles counts cache cleaning, not uploads,
and Time Machine kept finishing into the machine's buffer, so every light
stayed green while nothing reached Drive. The status reads the end of
rclone's log: a refusal newer than the last upload means the limit holds.
vm-status and backup-health report it.

vm-guard --dry-run prints the guard's decision for every Time Machine
state instead of acting, so thresholds can be tried on a throwaway machine
without pausing the live backup (Time Machine is global).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AU1MhxJW1e9oTB2XvjX8WT
On 27.10.2026 a new machine's first boot took 30 min: Lima copies every
`mode: data` file with `sudo -iu root`, and while cloud-final runs logind
cannot open the session, so pam_systemd times out after 2 min per file.
`limactl start` gave up after its default 10 min and vm-setup failed on a
new Mac or a restore. Later boots take ~12 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AU1MhxJW1e9oTB2XvjX8WT
@mbeczynski
mbeczynski merged commit b9dc0d3 into main Oct 27, 2026
4 checks passed
@mbeczynski
mbeczynski deleted the feat/vm-tm-meta-sync branch October 27, 2026 19:29
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