From 261e5c4468b218415a0807e6b7ca840d4ff00795 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Sat, 21 Nov 2026 14:02:35 -0800 Subject: [PATCH 1/2] docs: snapshots, restore and getting space back for walstore-chunk volumes Co-Authored-By: Claude Opus 5.5 --- seaweed-block/docs/standalone-deployment.md | 66 +++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/seaweed-block/docs/standalone-deployment.md b/seaweed-block/docs/standalone-deployment.md index 1a4df0c0ff..4855db784b 100644 --- a/seaweed-block/docs/standalone-deployment.md +++ b/seaweed-block/docs/standalone-deployment.md @@ -285,3 +285,69 @@ step stops it. In order, it: The script's default engine is `SW_BLOCK_DURABLE_IMPL=smartwal`; the command above sets `walstore`, the engine used by the Kubernetes chart and the workspace path. There is no equivalent script for ublk yet. + +## Snapshots, restore and space (walstore-chunk) + +The commands below use these placeholders: +- `FILER` is the SeaweedFS filer gRPC address (`--chunk-filer`). +- `MASTER` is the blockmaster address the blockvolumes use. +- `STATUS` is a blockvolume's status address (its `--status-addr`, with `--chunk-control-endpoint` set). + +### Scheduled snapshots + +- **Schedule:** with the default `--chunk-snapshot-schedule=daily:7`, each attached volume takes one named snapshot (`sched-`) once per 24 h, at a per-volume offset rather than at a wall-clock hour. +- **Retention:** keeps the newest 7 scheduled snapshots. Other snapshots are not affected. +- **Restoring volumes:** a volume still restoring is skipped, and the skip is counted. +- **Status:** `GET STATUS/status/durable?volume=` shows the schedule under `Chunk.ScheduledSnapshot`: `lastOkNs`, `nextDueNs`, `lastFailure`, `skipped` and `snapshot_overdue`. + +```bash +sw-block ops chunk snapshots --volume v1 --chunk-filer FILER # list +sw-block ops chunk snapshot --volume v1 --name before-upgrade --status-addr STATUS # take one now +``` + +### Deleting snapshots and getting space back + +Space comes back in two steps. Neither is immediate. + +1. **GC deletes the chunks**, after the grace. The grace is `sw-block ops chunk gc --grace`, **1 hour by default**. + - A deleted snapshot keeps its chunks rooted for the grace after the delete. + - A chunk is then reclaimed only once two complete GC marks, at least the grace apart, have both seen it unreferenced. + - With the default grace, a deleted snapshot's chunks are reclaimed about **2 hours** after the delete. That needs a GC pass at least 1 hour after the delete and another at least 1 hour after that. + - Automatic GC is off by default (`--chunk-maintenance-gc`), so run the passes yourself: + + ```bash + sw-block ops chunk snapshot-delete --volume v1 --name sched-20261120T031204Z --chunk-filer FILER + # one hour or more later, and again one hour or more after that: + sw-block ops chunk gc --chunk-filer FILER --master MASTER --apply + ``` + + - Each pass prints its `Candidates`, `Reclaimed` and `failed_deletes`. + - A chunk shows as a candidate in the first pass that sees it and is reclaimed in a later pass. + - Without `--apply`, a pass is read-only. +2. **SeaweedFS vacuum compacts the volume files.** Reclaimed chunks are deleted needles: SeaweedFS counts them at once in `DeletedByteCount` (`curl http:///vol/status`, or `volume.list` in `weed shell`), but the disk space returns only when SeaweedFS vacuums those volumes, which runs asynchronously. To ask for it now: `curl "http:///vol/vacuum?garbageThreshold=0.01"`, or `volume.vacuum` in `weed shell`. + +Check the data afterwards. `--depth data` reads every chunk once. Exit 0 means clean, 3 means the pass found problems. + +```bash +sw-block ops chunk verify --volume v1 --chunk-filer FILER --all-snapshots --depth data --timeout 30m +``` + +### Restoring a snapshot into a new volume + +A restore makes a new, independent volume from a snapshot. The source volume and its snapshot can be deleted afterwards. + +1. **Add the target to blockmaster.** Add the target volume (for example `v2`) to blockmaster's topology, and start a blockvolume for it with the same chunk settings (`--chunk-filer`, `--chunk-path`, `--chunk-control-endpoint`) and the source's geometry. +2. **Create the restore and start it:** + + ```bash + sw-block ops chunk restore --source v1 --snapshot sched-20261120T031204Z --target v2 --chunk-filer FILER --status-addr STATUS_OF_V2 + ``` + + This creates `v2` from the snapshot (idempotent by `--request-id`; the generated id is printed, so reuse it to retry) and starts the restore driver in v2's blockvolume. + - **Before the target is attached:** run the same command without `--status-addr` to create `v2`. Once its blockvolume is up, run `sw-block ops chunk restore --volume v2 --status-addr STATUS_OF_V2` to start the driver. +3. **v2 serves at once.** It reads chunks it does not hold yet from the source's snapshot. + - Meanwhile the driver fetches every chunk and re-uploads them under v2's own keys. + - It then marks v2 independent: phases `hydrating`, then `owning`, then `independent`. + - Follow it with `sw-block ops chunk restore --volume v2 --status-addr STATUS_OF_V2 --status`. + - Until v2 is independent, a snapshot of v2 is refused (`restore_incomplete`). + - While v2 still fetches chunks, its scheduled snapshots are skipped and counted as `restoring`. After that, until it is independent, they are refused like any snapshot and show as failed attempts with that code. From ef1a70382a309e7ddb24ea95e8406be094493dd7 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Sat, 21 Nov 2026 14:13:54 -0800 Subject: [PATCH 2/2] docs: recovery point and consistency first; control endpoint exposure; vacuum commands; verify exit codes Co-Authored-By: Claude Opus 5.5 --- seaweed-block/docs/standalone-deployment.md | 39 +++++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/seaweed-block/docs/standalone-deployment.md b/seaweed-block/docs/standalone-deployment.md index 4855db784b..ac65e979c0 100644 --- a/seaweed-block/docs/standalone-deployment.md +++ b/seaweed-block/docs/standalone-deployment.md @@ -288,15 +288,31 @@ workspace path. There is no equivalent script for ublk yet. ## Snapshots, restore and space (walstore-chunk) +**Recovery point.** +- **A stopped volume** keeps everything it acknowledged, on its host. +- **If the host is lost,** the volume is restored from its last cut. With the defaults (periodic capture off, one scheduled snapshot a day), that cut is at most one day old. +- **For a newer recovery point,** cut more often (`--chunk-capture-interval`, at least 5 minutes), or take a snapshot right before risky work. + +**Consistency.** A snapshot is crash-consistent: +- it holds every write the volume acknowledged up to the cut; +- a guest file system restored from it replays its journal; +- data an application had not fsynced may be missing. + The commands below use these placeholders: - `FILER` is the SeaweedFS filer gRPC address (`--chunk-filer`). - `MASTER` is the blockmaster address the blockvolumes use. +- `WEED_MASTER` is the SeaweedFS master HTTP address. - `STATUS` is a blockvolume's status address (its `--status-addr`, with `--chunk-control-endpoint` set). +**About the control endpoint.** `--chunk-control-endpoint` carries destructive operations (cut, snapshot, snapshot delete, detach, restore) on the status listener. +- **Binding:** that listener binds loopback addresses only, unless `--allow-external-status-bind` is set. +- **No authentication:** nothing authenticates it in this release. Keep it on loopback, or behind your own access control. + ### Scheduled snapshots - **Schedule:** with the default `--chunk-snapshot-schedule=daily:7`, each attached volume takes one named snapshot (`sched-`) once per 24 h, at a per-volume offset rather than at a wall-clock hour. -- **Retention:** keeps the newest 7 scheduled snapshots. Other snapshots are not affected. +- **Retention:** keeps the newest 7 scheduled snapshots. It counts only the scheduled class, so other snapshots are not affected. +- **Deleting by hand:** scheduled snapshots are safe to delete with `snapshot-delete` like any other. - **Restoring volumes:** a volume still restoring is skipped, and the skip is counted. - **Status:** `GET STATUS/status/durable?volume=` shows the schedule under `Chunk.ScheduledSnapshot`: `lastOkNs`, `nextDueNs`, `lastFailure`, `skipped` and `snapshot_overdue`. @@ -324,9 +340,26 @@ Space comes back in two steps. Neither is immediate. - Each pass prints its `Candidates`, `Reclaimed` and `failed_deletes`. - A chunk shows as a candidate in the first pass that sees it and is reclaimed in a later pass. - Without `--apply`, a pass is read-only. -2. **SeaweedFS vacuum compacts the volume files.** Reclaimed chunks are deleted needles: SeaweedFS counts them at once in `DeletedByteCount` (`curl http:///vol/status`, or `volume.list` in `weed shell`), but the disk space returns only when SeaweedFS vacuums those volumes, which runs asynchronously. To ask for it now: `curl "http:///vol/vacuum?garbageThreshold=0.01"`, or `volume.vacuum` in `weed shell`. +2. **SeaweedFS vacuum compacts the volume files.** Reclaimed chunks are deleted needles. + - SeaweedFS counts them at once in `DeletedByteCount`. + - The disk space returns only when SeaweedFS vacuums those volumes, which runs asynchronously. -Check the data afterwards. `--depth data` reads every chunk once. Exit 0 means clean, 3 means the pass found problems. + To check the count, and to ask for a vacuum now: + + ```bash + curl http://WEED_MASTER/vol/status # DeletedByteCount per volume + curl "http://WEED_MASTER/vol/vacuum?garbageThreshold=0.01" # compact volumes with more than 1% garbage + # or, in weed shell: volume.list and volume.vacuum -garbageThreshold 0.01 + ``` + +Check the data afterwards. `--depth data` reads every chunk once. + +| Exit | Meaning | +|---|---| +| 0 | clean | +| 3 | the pass found problems | +| 1 | the pass could not complete, for example a filer or master is unreachable; the partial result is printed | +| 2 | the command could not run: a usage error, or the filer is not the only filer of its group (it refuses to start) | ```bash sw-block ops chunk verify --volume v1 --chunk-filer FILER --all-snapshots --depth data --timeout 30m