feat: add btrfs subvolume, snapshot, and rollback tooling
- init.sh: creates the @ / @home / @log / @snapshots subvolume layout on a target device (the installer step). - snapshot.sh: scheduled read-only snapshots with pruning, installed as /usr/local/sbin/arcline-snapshot. - rollback.sh: safe boot-to-snapshot rollback that refuses to touch the live @ and promotes a snapshot atomically.
This commit is contained in:
38
btrfs/README.md
Normal file
38
btrfs/README.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# btrfs in Arcline OS
|
||||
|
||||
Arcline OS is **btrfs-native**: the root filesystem layout is created at
|
||||
install time and snapshots are first-class, not bolted on.
|
||||
|
||||
## Subvolume layout
|
||||
|
||||
| Subvolume | Mount point | Purpose |
|
||||
|--------------|---------------|------------------------------------------------|
|
||||
| `@` | `/` | system root — rolled back on failed upgrade |
|
||||
| `@home` | `/home` | user data — not rolled back by default |
|
||||
| `@log` | `/var/log` | logs survive rollbacks |
|
||||
| `@snapshots` | `/.snapshots` | read-only snapshots live here |
|
||||
|
||||
The layout is created by `btrfs/init.sh <device>` (this is what the installer
|
||||
runs). `/etc/fstab` templates live in each edition manifest and reference these
|
||||
subvolumes with `subvol=` mount options.
|
||||
|
||||
## Tooling
|
||||
|
||||
- `btrfs/init.sh <device>` — create the subvolume layout on a target device.
|
||||
- `btrfs/snapshot.sh` — snapshot / list / prune. Installed in images as
|
||||
`/usr/local/sbin/arcline-snapshot` and triggered automatically by the
|
||||
`arcline-snapshot.timer` systemd unit (see `overlays/base/usr/lib/systemd/system/`).
|
||||
- `btrfs/rollback.sh` — promote a snapshot back to `@`. Installed as
|
||||
`/usr/local/sbin/arcline-rollback`.
|
||||
|
||||
## How a rollback works
|
||||
|
||||
Rollbacks are done from a rescue/live environment (never against the mounted
|
||||
`@`). The tool moves the current `@` aside to `@.rollback-<ts>` and promotes
|
||||
the chosen snapshot to `@`. Because btrfs renames are atomic, a crash mid-way
|
||||
leaves a recoverable system on disk.
|
||||
|
||||
## Compression
|
||||
|
||||
All subvolumes mount with `compress=zstd:3` (see the edition `fstab`
|
||||
templates). Transparent compression is on by default.
|
||||
Reference in New Issue
Block a user