mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 19:17:28 +01:00
The note lists what v1.0.1 adds and fixes, its upgrade, limits and known
limits, checked against this branch. README, troubleshooting, the cleaning
page and the operator guide no longer call those changes unreleased; the
operator guide describes the CLI's own repeat of 5-minute requests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit e883ade9be)
306 lines
20 KiB
Markdown
306 lines
20 KiB
Markdown
# Seaweed Block
|
||
|
||
[](docs/releases/v1.0.0.md)
|
||
[](https://github.com/seaweedfs/seaweed-block/actions/workflows/test.yml)
|
||
[](go.mod)
|
||
[](LICENSE)
|
||
|
||
**Block storage for AI agent workspaces at local-disk speed, with snapshots, restore and moves backed by your own
|
||
[SeaweedFS](https://github.com/seaweedfs/seaweedfs).** Each sandbox or microVM gets a plain virtio block disk. Writes
|
||
and `fsync` complete on the host's local disk; cuts copy the changed data to SeaweedFS in the background. Losing the
|
||
host loses what was written since the last successful cut: normally about a day with the default schedule (one
|
||
snapshot a day), not a guaranteed bound; `--chunk-capture-interval` (5 minutes or more) cuts more often. The same core serves Kubernetes block volumes (alpha).
|
||
|
||
<p align="center">
|
||
<img src="docs/assets/seaweed-block-hero.svg" alt="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." width="100%">
|
||
</p>
|
||
|
||
## Install
|
||
|
||
The binaries are `blockmaster`, `blockvolume` and the `sw-block` CLI. The commands on this page are for v1.0.0.
|
||
**Option 1:** copy them from the v1.0.0 image,
|
||
`ghcr.io/seaweedfs/seaweed-block:v1.0.0` (index digest
|
||
`sha256:648980beb519a086349d44367e9d19ba6ae94b8939456ae3eb7b7bb5e4b3b28b`):
|
||
|
||
```bash
|
||
docker create --name swb-extract ghcr.io/seaweedfs/seaweed-block:v1.0.0
|
||
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 `v1.0.0` (the Go version in `go.mod`):
|
||
```bash
|
||
git clone --branch v1.0.0 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](#quick-start-kubernetes-alpha).
|
||
Services: [standalone deployment](docs/standalone-deployment.md). Operator guide (supported setup, sizing, recovery point, host loss, limits): [operator guide](docs/operator-guide.md).
|
||
|
||
## Try it
|
||
|
||
The [first volume check](docs/standalone-deployment.md#first-volume-read-only-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](docs/standalone-deployment.md#write-test-scratch-host-only) (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:
|
||
|
||
```bash
|
||
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](docs/standalone-deployment.md#restoring-a-snapshot-into-a-new-volume)).
|
||
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](docs/standalone-deployment.md#quick-start-sw-block-mini).
|
||
|
||
## 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](#measured-results), [how each was measured](docs/workspace-measurements.md)).
|
||
- **`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 the release candidate (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](docs/workspace-measurements.md)).
|
||
- **Snapshots in your object store.** A cut uploads only the changed 4 MiB chunks. A snapshot names a root of about
|
||
2 KB and shares its chunks; a restore makes a new volume that reads them on first use
|
||
([agent workspace design](docs/design/agent-workspace-design.md)).
|
||
- **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](docs/volume-lifecycle.md), [TLA+ specifications](docs/spec/README.md)).
|
||
- **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](docs/workspace-measurements.md)).
|
||
|
||
## Measured results
|
||
|
||
<picture>
|
||
<source media="(prefers-color-scheme: dark)" srcset="docs/assets/measured-results-dark.svg">
|
||
<img src="docs/assets/measured-results-light.svg" alt="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." width="100%">
|
||
</picture>
|
||
|
||
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](https://github.com/seaweedfs/seaweed-block/pull/173)). The chart is drawn from
|
||
[measured-results.csv](docs/assets/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) | 0.18 ms | |
|
||
| Two-host lifecycle (pre-release): create, snapshot, fork, move, stale holder, delete, GC | 35 of 35 checks | |
|
||
|
||
The snapshot row is a host-side proxy without network latency, guest `fsync` or the block frontend. 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 v1.0.0's supported frontends (NVMe/TCP and iSCSI).
|
||
[Workspace measurements](docs/workspace-measurements.md) 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.
|
||
- **v1.0.0 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 256 GiB. See the
|
||
[release note](docs/releases/v1.0.0.md) and its [known limits](docs/releases/v1.0.0.md#known-limits).
|
||
- **Replicated volumes** are a preview ([replicated volumes preview](docs/releases/replicated-volumes-preview.md)).
|
||
- **Kubernetes** is an alpha, for supported lab clusters ([Kubernetes status](docs/kubernetes-status.md)).
|
||
|
||
## 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.0.1):** single-replica volumes up to 256 GiB 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
|
||
release candidate); 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. v1.0.1 adds `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 a working `ops chunk verify` (see the [v1.0.1 note](docs/releases/v1.0.1.md)).
|
||
- **After that, planned:** volumes up to 1 TiB (v1.1); 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:
|
||
|
||
```bash
|
||
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](docs/volume-lifecycle.md#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](docs/standalone-deployment.md#restoring-a-snapshot-into-a-new-volume).
|
||
In v1.0.0 the chunk path (`walstore-chunk`) is the supported single-replica
|
||
configuration ([release note](docs/releases/v1.0.0.md), [operator guide](docs/operator-guide.md));
|
||
it is not the `--durable-impl` default.
|
||
|
||
## Quick start: Kubernetes (alpha)
|
||
|
||
For supported lab clusters, not production. From the repository root, with
|
||
`kubectl` and `helm` configured:
|
||
|
||
```bash
|
||
go build -o sw-block ./cmd/sw-block && export PATH="$PWD:$PATH"
|
||
sw-block ops generate-helm-values --out values.day1.yaml \
|
||
--image ghcr.io/seaweedfs/seaweed-block:sha-dc2972d0059b \
|
||
--csi-image ghcr.io/seaweedfs/seaweed-block-csi:sha-dc2972d0059b
|
||
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`. `sha-dc2972d0059b` is
|
||
the validated tag for the v0.4 read-only status path; later paths need
|
||
matching [release images](docs/kubernetes-status.md#release-images), and
|
||
`:alpha` is for smoke tests only. Each step's output is in the [Kubernetes
|
||
quickstart](docs/quickstart-kubernetes.md). To clean up:
|
||
|
||
```bash
|
||
helm uninstall sw-block --namespace kube-system
|
||
bash scripts/uninstall-k8s-alpha.sh "$PWD" && bash scripts/verify-helm-cleanup.sh
|
||
```
|
||
|
||
## Detailed status
|
||
|
||
| Area | Status |
|
||
|---|---|
|
||
| Agent workspace disks (`walstore-chunk`), single replica | Supported in v1.0.0; see its [known limits](docs/releases/v1.0.0.md#known-limits) |
|
||
| Replicated volumes (`replication_factor` above 1) | Preview in v1.0.0 ([replicated volumes preview](docs/releases/replicated-volumes-preview.md)) |
|
||
| Kubernetes: Helm install, PVC provisioning, writer/reader check, read-only report and dashboard, CRD status and Events, support-bundle replay | Available (alpha) |
|
||
| Kubernetes: RF=3 multi-volume, CSI reattach recovery, iSCSI ALUA/dm-multipath mounted failover, restart persistence with hostPath | Gated (supported lab) |
|
||
| Kubernetes: `SwBlockVolume` finalizer lifecycle owner, returned-replica ACK eligibility executor | Beta candidate |
|
||
| Kubernetes: NVMe/TCP CSI multipath, returned-replica failback runtime, WAL multi-block record opt-in | Source-gated |
|
||
| Kubernetes: backup, snapshot and restore; returned-replica rebuild traffic | Planned |
|
||
|
||
Full table and conditions: [Kubernetes status](docs/kubernetes-status.md);
|
||
run evidence: [release notes](docs/releases/README.md).
|
||
|
||
**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](docs/quickstart-kubernetes.md)).
|
||
|
||
### 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 `smartwal` engine, which is experimental: no rollback for a torn
|
||
in-place overwrite, no per-block CRC once its ring record recycles, open
|
||
handling of a corrupted committed record, and no chunk snapshots.
|
||
- Kubernetes: backup and restore, a production operator, automatic failback
|
||
or cleanup, upgrade execution, broad compatibility, and more: see
|
||
[what you should not expect yet](docs/kubernetes-status.md#what-you-should-not-expect-yet).
|
||
|
||
## Correctness and verification
|
||
|
||
- **CI** runs `go build`, `go vet` and `go test -short` on every pull request
|
||
and push to `main` ([workflow](.github/workflows/test.yml)); 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](docs/design/block-design.md#part-2-verification-lessons-known-issues),
|
||
with the known issues.
|
||
- **Formal models**: [TLA+ specifications](docs/spec/README.md) of the
|
||
protocols where a bug would lose data. Counterexamples became fixes and
|
||
regression tests ([#152](https://github.com/seaweedfs/seaweed-block/pull/152), [#156](https://github.com/seaweedfs/seaweed-block/pull/156), [#158](https://github.com/seaweedfs/seaweed-block/pull/158), [#159](https://github.com/seaweedfs/seaweed-block/pull/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
|
||
|
||
- Design: [core](docs/design/block-design.md), [agent workspace](docs/design/agent-workspace-design.md),
|
||
[Kubernetes block](docs/design/kubernetes-block-design.md), [invariants and state machines](docs/design/invariants.md),
|
||
[TLA+ specifications](docs/spec/README.md),
|
||
[workspace measurements](docs/workspace-measurements.md)
|
||
- Operations: [standalone deployment](docs/standalone-deployment.md),
|
||
[volume lifecycle](docs/volume-lifecycle.md),
|
||
[Kubernetes quickstart](docs/quickstart-kubernetes.md), [user capabilities](docs/user-capabilities.md)
|
||
- Claims: [Kubernetes status](docs/kubernetes-status.md), [release notes](docs/releases/README.md),
|
||
[NVMe/TCP supported-lab claim](docs/releases/nvme-tcp-supported-lab.md),
|
||
[known issues and work in progress](docs/design/block-design.md#24-known-issues-and-work-in-progress)
|
||
- Engineering references, not release-claim sources: [architecture](docs/architecture.md),
|
||
[developer architecture](docs/developer-architecture.md), [runtime state machines](docs/runtime-state-machines.md)
|
||
|
||
## Development
|
||
|
||
```bash
|
||
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](https://github.com/seaweedfs/seaweed-block/issues). Seaweed Block builds on
|
||
[SeaweedFS](https://github.com/seaweedfs/seaweedfs).
|
||
|
||
## License
|
||
|
||
Apache-2.0
|