64 lines
1.8 KiB
Markdown
64 lines
1.8 KiB
Markdown
# Recovery
|
||
|
||
Cheapest first. Layers 1–2 are inside the guest; 3–4 are host-side hermenix.
|
||
|
||
```bash
|
||
# Guest NixOS history
|
||
hermenix vm ssh "git -C /etc/nixos log --oneline"
|
||
hermenix vm ssh "sudo nixos-rebuild switch --rollback" # also in boot menu
|
||
|
||
# State-disk snapshot
|
||
hermenix vm snapshot
|
||
hermenix vm snapshots
|
||
hermenix vm rollback state-20260914-1400 # type 'rollback' to confirm
|
||
|
||
# Restic backup of state files
|
||
hermenix vm backup
|
||
hermenix vm backups
|
||
```
|
||
|
||
Identity files under Hermes home can be inspected with `hermenix ctl soul`
|
||
etc.; restoring _Hermes_ app state is mostly "roll the state disk" or restore
|
||
from backup — not a separate product flow.
|
||
|
||
## Snapshots
|
||
|
||
Hourly, keep 48, **state disk only**. System disk: re-image with
|
||
`hermenix setup`.
|
||
|
||
fsfreeze via qemu-guest-agent around each shot. `rollback` stops the VM, moves
|
||
current state to `state.old-<timestamp>`, restores snapshot — reversible until
|
||
you delete `state.old-*`.
|
||
|
||
Keep retention tighter than on ZFS: state image is nodatacow; live snapshots
|
||
reintroduce CoW on referenced blocks.
|
||
|
||
## Backups
|
||
|
||
```nix
|
||
services.hermenix.backup = {
|
||
enable = true;
|
||
repository = "sftp:backup@nas:/hermes";
|
||
passwordFile = "/var/lib/secrets/hermes-restic";
|
||
};
|
||
```
|
||
|
||
State **files** over vsock/SSH into restic — not the raw disk. Portable;
|
||
avoids loop-mounting agent-controlled FS on the host. Runs on the host (no
|
||
`lanAccess` needed for a LAN repo).
|
||
|
||
## Guest won't boot
|
||
|
||
Re-image **system** only (`hermenix setup` write step); leave state disk.
|
||
Identity + `/etc/nixos` + workspace return with it.
|
||
|
||
## Starting completely fresh
|
||
|
||
```bash
|
||
hermenix setup --clean
|
||
```
|
||
|
||
Stops VM; deletes `system.raw` / `state.raw` / UEFI vars; drops stale
|
||
`known_hosts` for the guest host key; walks setup again. Subvolumes/snapshots
|
||
kept. Type `clean` to confirm.
|