Files
seaweedfs/seaweed-block
pingqiu-cpu bddb559dff fix(k8s): generated volumes' state is apart from blockmaster's stores (#1036)
Merge note (batch b13; pull_request_target spec-trace workflow has a startup_failure, so its checks run locally):
- One Test run (47268279447) succeeded (go test (linux), process-level tests (real binaries)) on the integration tree 78104cee = main 40c56035 + #1033 #1034 #1036 #1038 #1035  in this order; these squash merges reproduce that tree, verified after the last one.
- spec-trace-check.sh and public-text-check.sh, run with main's scripts against this head and body: both exit 0.
2026-12-03 21:15:22 -08:00
..
…

Seaweed Block

tag CI Go License

Local-speed execution. Portable workspace state.

Block storage for AI agent workspaces, with checkpoints, restore and moves in your own SeaweedFS. Each sandbox or microVM gets a plain virtio block disk: writes and fsync complete on the host's local disk, close to local-disk speed (fsync about 1.3x local). A checkpoint copies the changed data to SeaweedFS.

  • Named checkpoints restore: sw-block ops chunk snapshot takes one on demand, and a restore makes a new volume from it. Scheduled cuts protect: --chunk-capture-interval (5 minutes or more) publishes the volume's current state, which a move or a lost host resumes from; a cut is not a restore point by name.
  • A checkpoint is confirmed only once it is in SeaweedFS: the command answers ok after its commit there, which follows the upload.
  • After a lost host, an operator's forced move (after the lease barrier) continues the workspace from its last confirmed checkpoint; the writes after it are lost, and reported. The default schedule, one snapshot a day (attempted, not guaranteed), suits sandboxes you can rebuild; a persistent agent should checkpoint at its task boundaries.

The same core serves Kubernetes block volumes (alpha).

Seaweed Block. Write path: an agent sandbox or microVM writes over NVMe/TCP or iSCSI to blockvolume, which completes the write and fsync on its local WAL and acknowledges; a write does not wait on SeaweedFS, except that a restored volume fetches each chunk from its snapshot once, on its first read or write. Background path: a cut (by default one scheduled snapshot a day; periodic cuts are optional) uploads only the changed 4 MiB chunks to your SeaweedFS, then updates the HEAD root with a conditional update on generation and epoch. blockmaster issues epochs and leases. Snapshots name a root and share chunks; a restore reads the snapshot's chunks on first use; a move hands the volume to another host at a higher epoch, and a stale holder's update is refused.

Measured (lab runs, median of 3; not SLOs; these pre-release numbers are replaced by the v1.1.1 launch numbers):

Measurement Seaweed Block Local disk Source and version
npm ci (617 packages, offline) 2.14 s 2.14 s pre-release build f7a6305, Firecracker microVM over NVMe/TCP loopback (measurements)
Guest fsync median (fio 4 KiB random write, one at a time) 3.59 ms 2.74 ms pre-release walstore-chunk after the group-commit fix (#173), same host (measurements)
Guest write pause during a checkpoint not yet published measured in the v1.1.1 launch run

Install

The binaries are blockmaster, blockvolume and the sw-block CLI, all three from one release: replace TAG below with the release, for example v1.1.0.

Option 1: download the release tarball and check it. Releases from v1.1.0 onwards carry it:

curl -fsSLO https://github.com/seaweedfs/seaweed-block/releases/download/TAG/sw-block-TAG-linux-amd64.tar.gz
curl -fsSLO https://github.com/seaweedfs/seaweed-block/releases/download/TAG/SHA256SUMS
sha256sum -c --ignore-missing SHA256SUMS && tar -xzf sw-block-TAG-linux-amd64.tar.gz --strip-components=1
./blockvolume --version      # must print the tag's commit

This is for v1.1.0, whose archive keeps the binaries in a directory. From v1.1.1 the archive holds the three binaries at its top and SHA256SUMS lists the archive: extract it without --strip-components (operations manual).

Option 1b: copy them from the release image ghcr.io/seaweedfs/seaweed-block:TAG (the release page gives its index digest):

docker create --name swb-extract ghcr.io/seaweedfs/seaweed-block:TAG
for b in blockmaster blockvolume sw-block; do docker cp swb-extract:/usr/local/bin/$b .; done
docker rm swb-extract && ./blockvolume --version

Option 2: build from the tag TAG (the Go version in go.mod):

git clone --branch TAG https://github.com/seaweedfs/seaweed-block && cd seaweed-block
for b in blockmaster blockvolume sw-block; do go build -o $b ./cmd/$b; done

Option 3: Helm, see the Kubernetes quick start. Services: standalone deployment. Operations manual (install, upgrade and finalize, isolation, monitoring, typed errors): operations manual. Operator guide (supported setup, sizing, recovery point, host loss, limits): operator guide.

Branches. v1.1.0 was tagged on the release-1.1 branch and the v1.0.x releases on release-1.0. main carries the next v1.1.x fixes (v1.1.1, unreleased) and later work: it is not a release. Do not run it for data you keep.

Try it

The first volume check starts blockmaster and one blockvolume, attaches a 256 MiB volume over NVMe/TCP on loopback, shows the device and its status, and stops. It does not format or write the attached device; it only creates local backing files and logs. It needs Linux, bash, nvme-cli, sudo and the binaries above. To format and write, use the write test (scratch host only).

sw-block mini

A trial on a scratch host, not for data you keep. One command starts a single-host trial on loopback, with SeaweedFS's weed mini as the chunk store (run against SeaweedFS 4.53). Build all three binaries from the same checkout and run the one you built, so that mini finds its matching blockmaster and blockvolume next to it:

git clone https://github.com/seaweedfs/seaweed-block && cd seaweed-block
for b in blockmaster blockvolume sw-block; do go build -o $b ./cmd/$b; done
./sw-block mini --dir ./swb-mini --weed /path/to/weed

It starts weed mini, blockmaster and one blockvolume (volume v1, 256 MiB, walstore-chunk with its chunk control endpoint). Snapshots of v1 work at once. A restore into a new volume is not possible inside a mini trial yet: mini's blockmaster is its own child and mini stops everything when a child exits, and that blockmaster refuses a volume that is not in its one-volume cluster spec while its product loop is off. To restore today, use the standalone setup (restoring a snapshot). It prints every command it runs and never runs sudo: it prints the nvme connect command that attaches v1, and the status, check and snapshot commands. Before you stop it with Ctrl-C, unmount v1 and run the sudo nvme disconnect it printed. If no weed is found on PATH and --weed is not given, it starts the local engine only, with no snapshots and a banner saying so; a --weed path that does not exist is refused. More in standalone deployment.

Why Seaweed Block

  • Close to local-disk speed for agent work. In a pre-release run on the walstore engine (the local engine the released chunk path builds on), npm ci, git clone and untar ran within 0-4% of a local disk for the operation itself. With the final file-system flush included on both sides, they were 11-23% slower than the local disk, and untar of 5,000 small files took about 2.2 times as long. On the released path, fsync costs about 1.3 times local (measured results, how each was measured).
  • fsync is durable on the host that serves the volume. Every guest fsync reaches the host's disk; no write cache is turned off to get the speed (a gate counts flushes against backend syncs, with an unsafe-cache control). In fault injection on v1.0.0-rc.3 (process kills and a store pause on one host; not a power-loss test), 0 acknowledged writes were lost across 253 judged; the same runs failed other operation checks, listed with the record. If the host itself is lost, the volume comes back from its last cut (records).
  • Snapshots in your object store. A cut uploads only the changed 4 MiB chunks. A snapshot names a root of about 2 KB for a 10 GiB volume (host-side proxy; it grows with the volume's chunk count) and shares its chunks; a restore makes a new volume that reads them on first use (agent workspace design).
  • Safe moves between hosts. One blockmaster issues epochs and leases, and a holder admits I/O only while its own lease is current; run exactly one blockmaster per cluster. Separately, every HEAD update is conditional on {gen, epoch}, so the store refuses a stale holder's publish even before that holder notices it was replaced (volume lifecycle, TLA+ specifications).
  • Self-hosted. Go, Apache-2.0, on your own hosts and your own SeaweedFS.
  • Against an early FUSE prototype on the same host (host-side, built on the SeaweedFS filer; not a released product), in the same pre-release run, untar, npm ci and git clone were 4 to 36 times faster with the final flush included; fsync-bound work took the same time (record).

Measured results

Time on Seaweed Block relative to a local disk, over NVMe/TCP loopback: npm ci 1.00, git clone 1.02, untar 100,000 files 1.04, cold find and stat 0.97, 2,000 create plus write plus fsync 1.52, guest fsync median 1.31.

Lab runs, median of 3; not SLOs. Workloads: Firecracker microVMs (4 vCPU, 4 GiB) on one bare-metal host over NVMe/TCP loopback, against a local file-backed disk. The first four rows come from a pre-release build on the walstore engine and time the operation itself. With the final syncfs flush included on both sides (recorded separately), the first three are 11-23% slower than the local disk (see the measurements page). The two fsync rows come from a later run of the released path (walstore-chunk) on the same host, after the group-commit fix (#173). The chart is drawn from measured-results.csv by docs/assets/readme-chart.py.

Measurement Seaweed Block Local disk
npm ci (617 packages, offline) / git clone (Go 1.23, local) 2.14 s / 7.10 s 2.14 s / 6.99 s
Untar 100,000 files / cold find + stat over them 1.10 s / 0.32 s 1.06 s / 0.33 s
2,000 × create + write + fsync 9.27 s 6.11 s
Guest fsync median, fio 4 KiB random write, one at a time 3.59 ms 2.74 ms
Snapshot of a 10 GiB volume (2,560 chunks); host-side proxy: local chunk files and a deterministic model of filer metadata calls, so no network, guest fsync or block frontend 0.18 ms
Two-host lifecycle (pre-release): create, snapshot, fork, move, stale holder, delete, GC 35 of 35 checks

The two-host lifecycle row is a pre-release run that included fork (removed from this release) and the earlier GC. The remaining cost is fsync: a median of 3.59 ms against 2.74 ms local over NVMe/TCP loopback. The ublk frontend measured 3.23 ms in the same run; ublk is not among the supported frontends of v1.0 or of the v1.1.x operations manual (NVMe/TCP and iSCSI). Workspace measurements has every number, the FUSE comparison and how each was measured.

Status and limits

  • Recovery point: a lost host loses what was written since the volume's last successful snapshot or cut: normally about a day with the default schedule (one scheduled snapshot a day, which is attempted, not guaranteed). --chunk-capture-interval (5 minutes or more) adds periodic cuts and shortens it.
  • Stopping: sw-block volume stop takes a cut by default, which publishes the volume to the object store (--no-cut skips it). A holder that stops any other way (systemctl stop, a kill, or the loss of its host) takes no cut, and writes acknowledged after its last cut are on that host's disk only (operator guide).
  • v1.1.x supports the single-replica volume (--durable-impl walstore-chunk), backed up to SeaweedFS with snapshots, restore, moves and volume delete. New volumes are at most 1 TiB; above 256 GiB they need format level 1: a new cluster starts at it, an upgraded cluster gets it from sw-block cluster finalize-format, and no volume above 256 GiB is created until every host runs v1.1. See the operations manual, its known limitations and the v1.1 notes.
  • Replicated volumes are a preview in v1.0 and v1.1 (replicated volumes preview).
  • Kubernetes is an alpha, for supported lab clusters (Kubernetes status).

Direction

Seaweed Block is block storage for AI agent workspaces: one local-speed disk per sandbox or microVM, with its history (snapshots, restores, moves) in your own SeaweedFS. The same core serves Kubernetes block volumes (alpha).

  • Works today (v1.1.x): single-replica volumes up to 1 TiB over NVMe/TCP or iSCSI; scheduled and manual snapshots; restore into a new volume; a planned hand-over to another machine (run across two machines on the v1.0 release candidate; two hosts); a forced move after a host is lost, from the volume's last cut (tested with two server identities on one machine); volume delete. Each is a documented sequence of sw-block ops commands and systemd units. Since v1.0.1: sw-block mini, a single-host trial; whole-job volume commands (sw-block volume start, stop, backup, restore); sw-block shell for inspection, with cluster.check and a troubleshooting page; a log bundle without secrets; and ops chunk verify (v1.0.1 note). v1.1 adds volumes above 256 GiB, up to 1 TiB, at format level 1 (new clusters start at it; upgraded clusters finalize) (v1.1 notes).
  • After that, planned: replicated volumes beyond the preview; export of a snapshot to another object store, and import from it; volume fork and volume move commands.

Agent workspace disks: chunk lifecycle

The workspace path runs blockvolume with --durable-impl=walstore-chunk, --chunk-filer <filer> and --chunk-control-endpoint, against a SeaweedFS cluster. The sw-block ops chunk commands drive the lifecycle:

sw-block ops chunk cut       --volume v1 --status-addr <status>  # publish changed chunks, advance HEAD
sw-block ops chunk snapshot  --volume v1 --status-addr <status> --name s1   # name a snapshot
sw-block ops chunk snapshots --master <blockmaster> --volume v1 --chunk-filer <filer>   # list snapshots
sw-block ops chunk restore   --master <blockmaster> --chunk-filer <filer> --source v1 --snapshot s1 --target v3  # new volume from a snapshot
sw-block ops chunk detach    --volume v1 --status-addr <status>  # final cut (seal); moving needs revoke + move, see docs/volume-lifecycle.md
sw-block ops chunk volume-delete --volume v3 --chunk-filer <filer> --master <blockmaster> --request-id del-v3

volume-delete is refused until the volume's holder has been revoked and its ACK is recorded, and while the volume has snapshots: see Delete a volume. Frozen detach and the pre-copy detach are not supported in this release: a detach with --frozen (frozen:true on POST /chunk/detach) is refused with 409 frozen_detach_unsupported, and blockvolume refuses to start with --chunk-detach-precopy. restore creates the target from the snapshot; its blockvolume serves at once and reads every chunk it has not made local from the source's snapshot (there is no background copy). The source snapshot cannot be deleted while the target exists. Fork is not supported in this release; the command is removed. See Restoring a snapshot. In v1.0 and v1.1.x the chunk path (walstore-chunk) is the supported single-replica configuration (operations manual, operator guide); it is not the --durable-impl default.

Detailed status

Agent workspace disks (walstore-chunk, single replica) are supported; replicated volumes are a preview; Kubernetes is an alpha. Each area's status by release, with its conditions: capabilities.

Upgrade note: blockmaster listens off loopback only with mutual TLS (--tls-cert, --tls-key, --tls-client-ca, --role-file); the runtime HTTP listener always stays on loopback, and --insecure-external-bind is refused. The Helm chart and the shipped manifests run with mutual TLS; create their Secrets first (quickstart).

Not claimed yet

  • Production readiness, SLOs, or a published performance, RTO or RPO claim.
  • fsync parity with local disk. Today it is about 1.3× local over NVMe/TCP (see Measured results).
  • ublk at high density. Unprivileged per-volume servers need a privileged control broker, which is not done.
  • Crash-restart recovery of a ublk server. A crashed server fails closed.
  • Multi-replica workspaces combined with chunk snapshots.
  • The experimental engines smartwal and parallel-walstore: removed in v1.1; their volumes are refused (copy the data to a walstore volume with v1.0.x first).
  • Kubernetes: backup and restore, a production operator, automatic failback or cleanup, upgrade execution, broad compatibility, and more: see what you should not expect yet.

Quick start: Kubernetes (alpha)

For supported lab clusters, not production. v1.1.0 is affected (its generated blockvolume pod cannot start); use the first release with the fix, as the Kubernetes quickstart says. From a checkout of that release tag, with kubectl and helm configured, sw-block in PATH, and the TLS Secrets created (Step 0 and Step 2 of the quickstart):

TAG=<the fixed release tag>
sw-block ops generate-helm-values --out values.day1.yaml \
  --image ghcr.io/seaweedfs/seaweed-block:$TAG \
  --csi-image ghcr.io/seaweedfs/seaweed-block-csi:$TAG
helm install sw-block charts/seaweed-block --namespace kube-system \
  --create-namespace -f values.day1.yaml --wait --timeout 10m
SW_BLOCK_INSTALL_MODE=helm SW_BLOCK_HELM_RELEASE=sw-block \
SW_BLOCK_HELM_NAMESPACE=kube-system SW_BLOCK_HELM_VALUES_FILE=values.day1.yaml \
  bash scripts/run-basic-app-example.sh "$PWD"

The last command writes a PVC from one pod and reads it from a replacement pod; expect first_volume_status=ok in /tmp/sw-block-basic-app-*/first-volume-summary.txt. Use the images of the release you checked out: the chart needs flags that older images lack. :alpha is for smoke tests only. Each step's output is in the Kubernetes quickstart. To clean up:

helm uninstall sw-block --namespace kube-system
bash scripts/uninstall-k8s-alpha.sh "$PWD" && bash scripts/verify-helm-cleanup.sh

Correctness and verification

  • CI runs go build, go vet and go test -short on every pull request and push to main (workflow); that set leaves out the four long, disk-heavy packages (a pull request runs those of them it changes); they run in full, together with the legacy-fixture configuration, on a separate test VM for every merge train (commit status full-suite (pool VM) on the train head). Crash, mutation, real-SeaweedFS and binary tests are described in the core design, Part 2, with the known issues.
  • Formal models: TLA+ specifications of the protocols where a bug would lose data. Counterexamples became fixes and regression tests (#152, #156, #158, #159).
  • Fail closed: recovery that cannot establish a consistent image reports a typed reason (wal_corrupt, io_error) instead of serving; some suspected damage (wal_hole_suspected) is a status warning only.

Documentation

Development

go build ./... && go vet ./... && go test -short ./...    # what CI runs
go test ./cmd/sw-block ./core/ops ./core/csi ./core/launcher ./core/host/master -count=1  # release-scoped

The full go test ./... sweep may include in-progress packages outside the release gate. scripts/activate-k8s-alpha.sh remains for local images.

Community

Questions and bug reports: GitHub Issues. Seaweed Block builds on SeaweedFS.

License

Apache-2.0