Skip to content

Etap 2: jeden układ (maszyna Lima + SMB), usunięty układ z obrazem dysku - #33

Merged
mbeczynski merged 2 commits into
feat/vm-samba-time-machinefrom
feat/vm-only
Oct 27, 2026
Merged

mbeczynski merged 2 commits into
feat/vm-samba-time-machinefrom
feat/vm-only

Conversation

@mbeczynski

Copy link
Copy Markdown
Contributor

Nałożone na #32 (baza feat/vm-samba-time-machine), więc diff pokazuje tylko etap 2.

macOS 27 nie przyjmuje obrazu dysku jako nowego celu Time Machine, więc stary układ (montowanie rclone przez FUSE-T na Macu, sparsebundle w /Volumes/CloudMachine) jest martwy. Zostaje jeden: maszyna cmsmb (Lima), Samba, punchfs, rclone w maszynie, cel smb://tm@<adres>/CloudMachine.

Bilans: +2563 / −11458 linii (100 plików).

Usunięte

  • Core: DriveBufferService, BackupImageService, ImageProbe, AttachStall, MountRestart, OrphanMount, InstallationTraces (z known-image), BufferGuardService, ShutdownPrep (odpinanie obrazu), FuseInstaller, BufferReadiness, UploadDrain, OpenPortAlert, CMLock, EdgeTriggeredLog; z CMActionResult pola didNotRun/attachTemporarilyUnavailable.
  • Polecenia agenta: mount-drive, create-image, attach-image, detach-image, verify-image, buffer-guard, restart-mount, install-fuse, drive-status (zastąpione przez vm-status).
  • Szablony launchd gdrive-buffer, gdrive-attach, buffer-guard; cel cloudmachine-poc (harnessy pomiarowe) i ich testy; testy usuniętego kodu.

Zmienione

  • install-launchd instaluje cztery agenty z launchd/: app, backup-health, vm-start, vm-guard (szablony vm przeniesione z launchd/vm/); vm-setup --install-agents woła to samo. Test pilnuje dokładnie tej czwórki i braku etykiet starego układu.
  • Migracja: AgentRepair.removeRetiredAgents() (przy starcie aplikacji, w install-launchd i w każdym backup-health) robi bootout i kasuje plist gdrive-buffer, gdrive-attach, buffer-guard (i bardzo stary mount), idempotentnie, z logiem. Niczego więcej nie kasuje: do logu trafia lista pozostałości (~/.cloudmachine/cache|drive|fuse|run, rclone.log, known-image, libfuse-t, stary folder obrazu na Drive), z ostrzeżeniem, jeśli coś jest jeszcze zamontowane (tablica montowań przez getfsstat(MNT_NOWAIT), bez wiszenia na martwym FUSE).
  • backup-health / BackupHealth.evaluate: maszyna (działa / zatrzymana / brak odpowiedzi), usługi (tm-bands-bind może być inactive przed vm-prepare-bundle, nigdy failed), cel TM po URL udziału, kolejka vfs/queue, porzucone pasma, wolne miejsce w maszynie i na Macu, deskryptory punchfs, otwarty port rc. Data ostatniej udanej kopii bez zmian (cel wybierany po LastKnownVolumeName, potem NetworkURL).
  • prepare-shutdown (VMShutdown): tmutil stopbackup, czekanie na opróżnienie vfs/queue (domyślnie do 30 min, --wait-minutes), potem limactl stop. Zaległość nie blokuje zatrzymania: rclone trzyma niewysłane pasma w buforze na dysku maszyny i wysyła je po starcie; czyste wyłączenie gościa chroni zapis w locie, którego zabicie maszyny razem z Makiem nie chroni.
  • TimeMachineStatus: parser bloków destinationinfo (URL, ID, Quota), control() przeniesione z BufferGuardService.tmutil dla VMGuard. set-limit, vm-status i karta limitu szukają celu po URL.
  • configure-remote tworzy gdrive:CloudMachine/<folder>-tm; ślad instalacji to plik hasła SMB maszyny (zamiast cache rclone); przy wymianie poświadczeń token sprawdzany na bands/ w folderze maszyny.
  • vm-status dostał wiersze z dawnego drive-status: folder Drive, limit i polecenie kwoty, czujka, agenci, niedostarczony alarm; hasło w URL-ach maskowane.

GUI

  • Karty: „Bufor maszyny” (do wysłania z vfs/queue, wolne w maszynie), „Maszyna” (stan cmsmb, usługi, Time Machine), „Stan maszyny i wysyłki” (adres, każda usługa, folder, do wysłania, cache, wolne, pliki punchfs, błędy, przycisk „Uruchom maszynę”), czerwona karta przy otwartym 127.0.0.1:5572. Usunięte: dysk/obraz/FUSE-T, rozmiar obrazu, „Sprawdź spójność obrazu”, „Zrestartuj montowanie”.
  • Kroki konfiguracji: install-rclone → configure-remote (z wyborem folderu) → brew install lima (do skopiowania) → „Skonfiguruj maszynę” (vm-setup) / „Uruchom maszynę” → Full Disk Access → agenty → sudo tmutil setdestination … (na ekranie hasło jako ••••••, „Kopiuj” daje pełne polecenie; nie trafia do logu ani komunikatu akcji) → po pierwszym obrazie „Przerób obraz” (vm-prepare-bundle).
  • Pasek menu: kafelki „Czeka na wysłanie” (GiB) i „Wolne w maszynie”, „Przygotuj do restartu” = VMShutdown, przycisk startu zatrzymanej maszyny. Styl RenaCodeTheme bez zmian; nowe teksty w L10nPolish+Machine.swift, nieużywane polskie wpisy usunięte.

Celowo zostawione

  • install-rclone i ~/.cloudmachine/bin/rclone (OAuth, rclone.conf kopiowany do maszyny, rclone size/about), configure-remote, set-limit/MachineBudget, DriveFolder, HealthAlert, WatchdogHeartbeat, AgentRepair, LaunchdInstaller, install-dependencies, UploadState (stany „brak miejsca na Drive” i „dzienny limit” nie są dziś zasilane - log rclone jest w maszynie; opisane w README jako ograniczenie).
  • Niczego z danych nie kasuję: cache starego układu i stary obraz na Drive zostają do ręcznego sprzątnięcia.

Bezpieczeństwo (znalezione przy okazji)

Lima domyślnie przekazuje porty localhost gościa na localhost Maca. rclone w maszynie ma --rc-addr 127.0.0.1:5572 --rc-no-auth, więc na Macu 127.0.0.1:5572 odpowiada (lsof pokazuje limactl na tym porcie) - każda strona w przeglądarce może wysłać polecenie, łącznie z usunięciem kopii. Szablon vm/cmsmb.yaml dostał portForwards z ignore: true; istniejąca maszyna potrzebuje tej reguły w ~/.lima/cmsmb/lima.yaml i restartu (opis w vm/README.md). Do tego czasu vm-status, czujka i aplikacja zgłaszają to jako awarię.

Sprawdzone

  • swift build, swift test (298 testów, 0 błędów), swift format lint --strict --recursive Sources Tests.
  • cloudmachine-agent build-app: Contents/Resources zawiera launchd/ (4 szablony), vm/ (z portForwards) i config/.
  • Nie uruchamiałem niczego na maszynie cmsmb, launchd ani Time Machine.

🤖 Generated with Claude Code

mbeczynski and others added 2 commits October 27, 2026 16:30
…isk-image layout

macOS 27 refuses a disk image as a new Time Machine destination, so the
rclone mount on the Mac and the image in /Volumes/CloudMachine are gone:
DriveBufferService, BackupImageService, ImageProbe, AttachStall,
MountRestart, OrphanMount, InstallationTraces, BufferGuardService,
ShutdownPrep, FuseInstaller, BufferReadiness, UploadDrain, OpenPortAlert,
CMLock, the POC harnesses, the gdrive-buffer/gdrive-attach/buffer-guard
agents and the commands that drove them.

- install-launchd installs app, backup-health, vm-start and vm-guard;
  the retired agents are booted out and their plists deleted on launch,
  by install-launchd and by backup-health; leftovers are only logged.
- backup-health judges the machine (Lima state, services, upload queue,
  free space, punchfs descriptors, the SMB destination) and the date of the
  last completed backup.
- prepare-shutdown stops the backup, drains the upload for a while and
  stops the machine cleanly.
- The app shows the machine and walks through install-rclone,
  configure-remote, brew install lima, vm-setup, tmutil setdestination
  (password masked on screen) and vm-prepare-bundle.
- vm/cmsmb.yaml forwards no ports: rclone's password-less remote control
  answered on the Mac's localhost; vm-status and the watchdog report it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AU1MhxJW1e9oTB2XvjX8WT
vm-status, backup-health and the app now show and check the SMB shaper; it
was installed by the template but missing from VMLayout.services. Checked
against the live machine after its restart (all five active).

The live machine also got the template's portForwards ignore rule: before
it, limactl published rclone's rc (127.0.0.1:5572, no auth) on the Mac's
localhost; after a restart the port is closed on the Mac and still answers
inside the machine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AU1MhxJW1e9oTB2XvjX8WT
@mbeczynski
mbeczynski merged commit 4020303 into feat/vm-samba-time-machine Oct 27, 2026
4 checks passed
@mbeczynski
mbeczynski deleted the feat/vm-only branch October 27, 2026 18:51
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