Files
seaweedfs/seaweed-block/docs/operator-guide.md
T
Ping Qiu 13d0627043 Merge pull request #864 from seaweedfs/fix/holder-cgroup-memory
blockvolume: derive the default Go soft memory limit from its cgroup
2026-11-30 22:59:12 -08:00

54 KiB
Raw Blame History

Operator guide (v1.0, standalone walstore-chunk volumes)

This page is the entry point for running Seaweed Block v1.0 outside Kubernetes. It says what is supported, where each task is documented, and which limits apply. Every command on the linked pages is listed at the end with the test that runs it.

What v1.0 supports

  • Volumes: walstore-chunk volumes, one volume per blockvolume process, with snapshots and moves through SeaweedFS.
  • Frontend: NVMe/TCP, the standalone default (the example units). iSCSI is supported too, and is the Kubernetes CSI default.
  • Layout: blockmaster and its authority store run off every volume host, on a node of their own (for example the SeaweedFS master or filer node), with durable storage. A volume host holds no authority state.
    • Do not run two blockmaster processes against the same store.
    • Why: a forced move after a host loss needs the authority record, the lease horizon and the lost range.
    • If those lived on the lost host, the volume could not be moved anywhere.
  • SeaweedFS durability (a premise): sw-block assumes SeaweedFS acknowledges a write only when it is durable; configuring SeaweedFS for that is the SeaweedFS deployment's responsibility.

Logs and verbosity

blockmaster and blockvolume accept --log-level info|debug (default info). For the CLI, put the global flag before the subcommand: sw-block --log-level debug ops workspace show .... This configures the DEBUG filter. HEAD writes and failed or working cut attempts remain INFO at both settings; successful cut no-ops without pending recovery or candidate/upload work appear only at DEBUG. An unsupported level is refused before the command runs.

Standard log timestamps are UTC with six fractional digits, for example 2026/11/28 22:10:05.123456. Ready JSON on stdout and command answers retain their existing formats. A HEAD-write line identifies head_write, volume, generation, session, resulting HEAD facts and elapsed milliseconds. Begin and commit are separate lines with the same session; errors do not claim a successful write. An ambiguous store answer emits WARN outcome=unknown with the expected generation: it describes an attempt, never proof of persistence. Log timestamps are observations, not authority or ordering proofs: use the generation and session fields to correlate writes.

At the default INFO level, failed cut attempts and attempts that do work report storage: cut phases: candidates_ms is the existing candidate-scan span; compare_prepare_ms includes comparison, proposal preparation and session admission; upload_ms includes copy/upload; commit_ms includes the HEAD exchange, also shown as head_write_ms; settle_ms groups HEAD readback, local commit state and map persistence. These are existing diagnostic spans and can overlap: do not sum them. phase_scope=publication means the phase spans describe the normal publication path. Recovery of an earlier unresolved publication can exchange HEAD before this path, then finish as a no-op: that recovery cost appears in total_ms, not necessarily in commit_ms or head_write_ms. noop does not mean the invocation made no remote call.

The same line carries attempt work even if it aborts: candidates is the planned set at the last staging/barrier step reached; compared counts completed chunk reads/hashes compared against HEAD, including repeated staging work; staged counts completed reusable staging results; uploaded counts payload PUTs completed or resolved by exact-byte readback in this attempt. A failed batch retains the work its workers finished. These are observations, not persistence proofs or runner verdict inputs; noop=true only says no new image was published.

work_scope=attempt applies to the new elapsed work spans: manifest_read_ms measures root/segment manifest reads; segment_writes_ms measures building and preparing segments plus their root (including reuse/tag checks); commit_check_ms measures the commit-check call, including its manifest/root preparation. They record elapsed time on errors as well as success, add repeated calls within the attempt, and can nest or overlap. They include pending-recovery work when it reaches those paths. An unstarted work span is zero; millisecond values are rounded to three decimals. Do not sum these spans.

The older publication spans are completion-dependent and rounded to three decimal places in milliseconds: zero can mean unfinished or unmeasured work, or rounding, rather than no work. A failed session begin or upload can consume time without its completion span being recorded. noop and err distinguish outcomes. total_ms is the independent attempt measurement up to logging; synchronous log output and subsequent cleanup can extend caller latency beyond it. Logging releases the statistics mutex first but remains within the cut's capture lock and in-flight lifetime.

The holder's /status/durable response also exposes Volumes[].HeadWrites, a snapshot of acknowledged HEAD writes by the census cause name since this holder's catalog started. Missing causes are zero. Counts survive temporary store handles and attachment retries within the same catalog, but reset with a new process/catalog. Volumes[].UnknownOutcome separately counts ambiguous HEAD-write answers by cause; a single in-memory snapshot reads both maps. Definite refusals count in neither map. UnknownOutcome never implies persistence: its write may have applied or not applied.

Runner comparisons use observations of the same live holder process and retain their own issued-operation history. In generation order, each step matches that history first, then an acknowledged count, then at most one unknown-outcome count whose census field mask fits the whole-HEAD diff. Each count is consumed at most once. An unmatched generation step is a violation; unused unknown counts are reported separately. The runner observes status before injecting a fault. A KILL window uses whole-HEAD census consistency and is reported as such; absence of a counter after KILL is not proof that a write never landed. Log sidecars are evidence, not verdict input. The versioned machine-readable table is head-write-census.json. Its may_change masks use the observed JSON key names: claim_id, activity, position, current, snapshots, snapshots[].Dependents, volume_id, epoch, holder and state. Snapshot membership/content excludes dependents of retained entries, which have their own group. Generation increments are specified separately from those field groups. The table records permitted changes; it does not itself establish which operations occurred, how many occurred, or that an operation was acknowledged.

The same response includes ProcessID, the existing live host process incarnation (not a new authority identity). Equal IDs are required before subtracting counters; a changed ID means a reset/kill window. If the source cannot supply a process identity, it is omitted and exact comparison is unavailable. Supported zero counter maps are {}, not omitted or null.

The runner loads the census from each holder's own product checkout at its recorded build, pins its version and SHA256 in the run header, and refuses categories its HEAD observation cannot read. Mixed-build holders use their own tables. Builds without the file or required status fields contribute coverage only, never an exact C5 pass.

The holder's /status/durable response exposes Volumes[].Chunk.CurrentCut while a cut is active, and omits it when idle. Its typed phase is one of admit, recover, stage, barrier, candidates, compare, upload, commit, or settle; started_at is the UTC time the current phase began, attempt_started_at is the start of the whole attempt, and attempt identifies the attempt within this layer's lifetime. Repeated phase visits retain the attempt and its start time but start a new phase time. A scheduled no-op may briefly show admit and other phases even on an idle volume; absence between polls does not prove no attempt occurred. These are in-memory observations, reset on a new attachment, and are never authority, ordering or proof of persistence. A status read does not wait for the cut's remote I/O. Runner boundary triggers use these typed fields rather than parsing log text. Only Chunk.CurrentCut is published; the counters do not expose a second copy.

Status phase Log measurement covering the phase
admit total_ms (admission and budget wait have no separate logged span)
recover total_ms; pending recovery is outside publication spans
stage total_ms; pre-barrier staging has no separate logged span
barrier total_ms; lock/drain/sync have no separate logged span
candidates candidates_ms
compare compare_prepare_ms and copy work within upload_ms
upload upload_ms; session admission also contributes to compare_prepare_ms
commit commit_ms, including head_write_ms; successful post-CAS confirmation also runs here, with its readback duration contributing to settle_ms
settle settle_ms (failed/unknown-CAS readback, local state and map persistence); this is not the sole phase in which HEAD is read

These are overlapping completion-dependent measurements, not a partition of attempt time. The zero, recovery and failure boundaries above still apply.

Clock safety requirement

While volumes are served, blockmaster's host must keep its wall clock slewed, not stepped. Configure chrony to allow makestep only at boot (for example, makestep 1 3 for the initial updates), and do not run ntpdate from a timer. Do not restart an initial-step clock configuration while leases are live. A wall-clock step larger than the configured clock-skew bound while a lease is live is outside the v1.0 supported envelope. Blockmaster requires half of --workspace-max-clock-skew to exceed its configured fence-exit budget (watch cadence 50 ms + drain timeout 5 s), assuming normal scheduling, so the skew bound must be above 10.1 s; the default 20 s passes.

Hosts' clocks stay within --workspace-max-clock-skew (default 20 s) of blockmaster's clock. Beyond it the lease bound does not hold: a volume could keep serving after blockmaster considers its lease over, and a start-up wait can be cut short. Keep every volume host and blockmaster on the same time source.

This is a safety premise, not a tested wall-step guarantee. The host's monotonic lease deadline does not remove this requirement on blockmaster's clock. See Part T TERM-LEASE-NOW-001 in the invariant contract.

Install

Standalone deployment:

  • the matching release files;
  • the required setup that makes a volume known to blockmaster;
  • the blockmaster and blockvolume settings;
  • a first read-only check, and a write test for a scratch host.

Host volume lock directory. Each blockvolume locks /run/sw-block/locks/<volume id>.lock, so a host runs at most one live blockvolume per volume (one process per volume).

  • A process run as root creates the directory itself.

  • The shipped unprivileged unit cannot create it, so install the tmpfiles.d entry deploy/systemd/sw-block.tmpfiles.conf:

    sudo install -m 0644 deploy/systemd/sw-block.tmpfiles.conf /etc/tmpfiles.d/sw-block.conf
    sudo systemd-tmpfiles --create /etc/tmpfiles.d/sw-block.conf
    
  • Without it, blockvolume exits at start with host volume lock directory unavailable. Install the entry, or chown the directory to the unit's user.

Authenticate the control API

blockmaster authenticates every gRPC call with mutual TLS when it starts with all four of --tls-cert, --tls-key, --tls-client-ca and --role-file. With them --audit-log <path> is required: without it blockmaster refuses to start (authentication needs --audit-log: every changing call is recorded before it runs, and is refused when it cannot be). Without the four it is in development mode: plaintext, loopback only, and it logs UNAUTHENTICATED CONTROL API on <addr> (development mode) once a minute. Upgrading: --insecure-external-bind is refused at start; drop it, and give a blockmaster that listens off-host the four mutual-TLS flags.

Who may call. The role file has one line per certificate: sha256:<hex fingerprint> <role> <id>. The role is viewer, operator, admin (people and tools; each includes the one before it) or node (a volume host; its id is its --server-id). A certificate's CN must equal its line's id. A node may act only for its own server id. Two lines with one node id are two keys of one server (for a rotation: add the new line, move the host to the new certificate, remove the old line), never two hosts: one server id names one host. A forced move needs admin. kill -HUP reloads the file. A removed line is refused from the next call, and its open streams end at the reload. A malformed file keeps the previous table and says so in the log. The audit log appends one JSON line per person's call, per role-file reload and per refused node call (at most once a minute per certificate and method). A changing call (create, delete, place, revoke, move, register a binding, failback) is written as an attempt before it runs: if the line cannot be written within 2 s the call is refused as "audit unavailable" and nothing happens. The attempt line is written without fsync: it survives a blockmaster crash, not a host crash or power loss. An unwritable audit log stops operator changes, never the volumes: node calls never wait on it, and reads and refusals are dropped and counted (GET /status/audit) when it falls behind.

Issue the certificates (one CA, one key per host or person; a node key gives control of that host's volumes, so never copy it into a host image):

openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes -days 3650 \
  -subj "/CN=sw-block CA" -keyout ca.key -out ca.crt
# blockmaster: the name volume hosts dial must be in subjectAltName
openssl req -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes -subj "/CN=blockmaster" \
  -keyout master.key -out master.csr
openssl x509 -req -in master.csr -CA ca.crt -CAkey ca.key -CAcreateserial -days 825 \
  -extfile <(printf "subjectAltName=DNS:master.example,IP:192.0.2.10") -out master.crt
# a volume host: CN = its --server-id
openssl req -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes -subj "/CN=node-a" \
  -keyout node-a.key -out node-a.csr
openssl x509 -req -in node-a.csr -CA ca.crt -CAkey ca.key -CAcreateserial -days 825 -out node-a.crt
# its role-file line
echo "sha256:$(openssl x509 -in node-a.crt -outform DER | sha256sum | cut -d' ' -f1) node node-a" >> roles

Volume hosts dial with --master-tls-cert, --master-tls-key and --master-ca. A volume refuses to start when its certificate's CN differs from --server-id. sw-block reads SW_BLOCK_TLS_CERT, SW_BLOCK_TLS_KEY and SW_BLOCK_TLS_CA. blockcsi takes --master-tls-cert, --master-tls-key and --master-ca. Certificate and key files are read at every new connection, so a rotated file takes effect without a restart. blockmaster closes each client connection after about 24 hours (gRPC adds up to 10% jitter, plus a 30 s grace), so a rotated or removed certificate is seen within about 26.5 hours even on an idle link. A role-file change applies at once. The volume's own HTTP routes (/status, chunk routes) are not authenticated and stay on loopback.

In Kubernetes each in-cluster client has its own certificate and Secret, with the least role its calls need: the CSI node and the status operator are viewer; the CSI controller (it deletes volumes) and the failback executor are admin. The CSI controller's key is an admin key: guard its Secret like an operator's admin key. The CSI node's certificate must have the viewer role; check the role file (the chart refuses a CSI node or status Secret named like an admin client's or blockmaster's, but it cannot see a certificate's role). scripts/k8s-alpha-certs.sh issues all four for a trial.

SeaweedFS is not authenticated. sw-block reaches the filer over gRPC without TLS and the volume servers over plain HTTP, with no SeaweedFS credentials of its own (it only passes on the write token the filer returns with each assignment, when SeaweedFS signs them); --chunk-filer, --chunk-path, --chunk-collection and --chunk-replication are its only SeaweedFS flags. Run SeaweedFS on a trusted network; mTLS covers the blockmaster control API only.

Size a host

  • Geometry: a volume's size is --durable-blocks x --durable-blocksize on blockvolume. It must equal size_bytes in the cluster spec (for example 65536 x 4096 = 268435456). A first start whose --durable-blocks or --durable-blocksize disagrees with the volume record is refused before any local store is created: it exits 78 (the unit does not restart it) with a line geometry_mismatch: --durable-blocks ... disagree with the volume record; correct the flag and start it again. If that first start cannot read the volume record because the filer failed the read, it exits 75 with the volume record of <vol> could not be read ... no local store was created; retrying and the unit starts it again. During a long outage the unit can reach its start limit; once the filer answers, run systemctl reset-failed <unit> and start it. If the record is there but corrupt, it exits 78 with the volume record of <vol> is unreadable (corrupt: ...): restore or recreate the record, then start it. A wrong-size local store left by an earlier release's first start is different: its log repeats chunk attach check: chunkstore: geometry_mismatch and it exits; waiting or restarting with the right flags does not help. In one sitting: stop the unit first; then check that the volume never served: sw-block ops chunk show --master <master> --volume <vol> --chunk-filer <filer> --chunk-path <path> prints "Epoch":0 and "Holder":"" in its head object; only then remove <vol>.bin, <vol>.bin.chunkfresh, <vol>.bin.chunkmap and <vol>.replica-floor from --durable-root, and start it with the right flags. If the head shows an epoch above 0 or a holder, do not remove these files; if the volume served before, its local store has its original size: correct the flag and start it again (not run as a test in this release).

  • Memory: plan for about 32-36 MiB per running volume. This is a planning figure: with 150-200 volumes on one host the sampled peaks were 32.6-37.3 MiB per process. These small-volume measurements do not size a large volume's cut. Each holder derives its Go soft memory limit from 90% of its effective cgroup v2 memory.max (the smallest finite limit in its cgroup ancestry), rounded down to MiB. The shipped systemd units set MemoryMax=2G per volume replica, giving a 1,843 MiB Go soft limit; this ceiling is not reserved RAM or a host admission budget. Set a per-instance drop-in for another size and budget the host for all holders together. With no finite cgroup v2 limit the default is 256 MiB. An explicit GOMEMLIMIT is preserved; --memory-limit-mib takes precedence over both it and cgroup detection (0 preserves the runtime limit). Automatic sizing requires the cgroup v2 memory controller. On cgroup v1, or a hybrid hierarchy without v2 memory.max, set --memory-limit-mib explicitly for a large volume; otherwise it receives the 256 MiB fallback. An unreadable or malformed cgroup limit refuses startup with a diagnostic; an explicit memory flag or GOMEMLIMIT bypasses this detection. Inspect Memory.SoftLimitBytes on the holder's status for the value in force.

  • Measured throughput on one host (three runs; 16 cores, 23.2 GiB RAM, one consumer NVMe drive, fsync on every volume):

    Volumes Aggregate IOPS, qd1 4k + fsync Aggregate IOPS, 4k qd32
    100 4,400-14,300 45,000-49,000
    150 5,300-9,100 37,000-39,000
    200 about 4,300 about 32,000
    • Above about 100 volumes the drive's flush rate, not the software, sets the limit.
    • Treat these numbers as one host class, not a guarantee.
  • Local disk: a volume's store grows sparsely up to its full size. Size each durable root's file system for every volume on it:

    • the volume size;
    • plus its WAL, 64 MiB;
    • plus room for a cut's copy-on-write side files. A cut writes them next to the store while guest writes overwrite blocks it has not uploaded yet.

    blockvolume refuses to create a volume when the durable root has less free space than its size plus the WAL (the refusal names both numbers), and warns at start when the free space is below its remaining growth plus the WAL; there is no override. The refusal ends the process with status 1 (blockvolume: durable storage open: ... needs N (size S + WAL W)), so the shipped unit starts it again every 5 s, refusing each time, until its start limit stops it; free space on that file system, then start the unit again. A restore target refused this way exists in the catalog but cannot start, and it can be neither deleted nor moved until it has started once: a delete wants it sealed, revoked and acknowledged, and a forced move is refused because the master knows no holder of it. To recover it, free space on that file system, or start it again on the same host with --durable-root on a local file system with room; then delete it with the usual steps if it is not wanted. The refused target still depends on its source snapshot: that snapshot and the source volume cannot be deleted until the target is deleted.

    Alert on local free space. On a full local disk, a Linux guest's writes fail after about 75 s with an I/O error (EREMOTEIO), and the guest file system may then go read-only. Once space is freed, new writes succeed without a restart. Data the guest had already flushed is kept.

  • --host-limit-dir: keep it on a local file system with free space. When it cannot be written, background cuts are refused (they fail closed); the seal at stop still runs.

  • SeaweedFS space: every cut and snapshot stores the chunks that changed since the previous one. Space comes back only by the holder's cleaning and then a SeaweedFS vacuum (below). An upload interrupted before its filer entry is created can leave an unreferenced needle; include this crash-window overhead in space accounting. Do not run volume.fsck with real deletion on a block cluster.

  • SeaweedFS capacity: a volume server holds at most -max SeaweedFS volumes, each up to the master's -volumeSizeLimitMB, so it stores at most -max x that size. Across the volume servers of the block collection, provide room for each block volume's written data (up to its size), plus the chunks that retained snapshots still reference after later writes replace them, times the collection's replication copies. Space freed by deleting snapshots returns only after cleaning and a vacuum (above). When the store is full, cuts and snapshots keep failing and are retried. Dirty and staged chunks are kept and guest writes are still acknowledged while local space lasts, but the recovery point stops advancing. A snapshot or cut request then answers remote_full (retryable once capacity is added), the durable status shows the code and SeaweedFS's answer in Chunk.Stats.LastCutFailure, and the holder logs one cuts failing WARN. A full store behind a follower master, or a master with volume growth disabled, still answers remote_unavailable. v1.0.1 answers a full store as remote_unavailable in every case. Alert on SeaweedFS capacity rather than waiting for this.

Each volume process reports its own heartbeat slot (server, volume and replica). The master orders each slot against that slot's previous report. In version 1.0, a backward host-clock step longer than the freshness window (30 seconds by default) can expire the host's slots; keep host clocks synchronized.

Recovery point and sync policy

  • A stopped volume keeps everything it acknowledged, on its host.
  • A lost host: the volume comes back from its last cut, the last point published to SeaweedFS.
    • Default: no periodic capture. One scheduled snapshot a day (--chunk-snapshot-schedule=daily:7).
    • So with defaults a host loss loses what was written since the last successful snapshot, normally up to about a day. The schedule is an attempt, not a bound: a failed attempt is retried (after 1 minute, doubling to 1 hour), each start of the holder places the next daily attempt again (it can be up to a day away), and a restored volume still fetching its chunks skips it.
  • For a newer recovery point: set --chunk-capture-interval (at least 5 minutes), or take a snapshot before risky work.
  • What does not publish: a stop, a lease revocation and a lease expiry publish nothing. Only a cut, a snapshot or a seal (ops chunk detach --plain) does. systemctl stop of a volume does not cut: before a stop after which the host might not come back (maintenance, an upgrade), run sw-block ops chunk cut first.
  • When SeaweedFS is unavailable (the filer or a volume server is down):
    • Guest I/O continues from the local disk; in the tests no guest command failed, and every answer came within the test's 20 s bound (about 2 s at the slowest in the one measured run; that run's record was not kept).
    • A cut in progress answers remote_unavailable (retryable) after about 30 s, the deadline of each chunk upload; no write the guest flushed is lost.
    • The next cut after the store returns commits normally and publishes everything written meanwhile.
    • A cut holds copy-on-write data on the local disk up to at most half of --host-limit-cow-bytes (1 GiB by default). A larger dirty set is uploaded before the cut point is fixed, so during a store outage such a cut fails without using local space. Guest I/O does not wait for the copy-on-write reserve.
    • Measured for outages of about 60 s, with the filer down and with a volume server down. Longer outages are not tested in 1.0.

Snapshots, restore and space

Warning: SeaweedFS's S3 backup sink is not a backup of a block volume. Measured with SeaweedFS 4.53: weed filer.backup with its S3 sink, pointed at a volume's directory in the block store (--chunk-path, /swblock/chunks by default), copied every object byte for byte but none of the attributes that sw-block keeps on each filer entry. A store put back from that copy did not open: blockvolume refused it and did not serve. The sink also uploads the whole object again on each update of its entry: three attribute-only updates of one unchanged 4 MiB chunk sent three full 4 MiB uploads. Export of a snapshot to another object store, and import from it, is planned for v1.0.2.

A chunk volume delete refuses to reserve a volume while its lease may still be live. Once the permanent reservation succeeds at blockmaster, the volume cannot be returned to service, even if a snapshot dependent refuses the next step. Resolve snapshot dependents and rerun with the same request id; the command asks blockmaster for a fresh no-live-lease proof before the HEAD compare-and-swap. A late upload by a dead holder into a deleted volume can remain; rerun volume-delete to sweep it.

After a refused restore (not_admitted), its target name is half created: run sw-block ops chunk release --master MASTER --source S --target T --chunk-filer FILER, then the delete of a volume that never served (step 4 of deleting a volume). A volume_not_found: layout: HEAD absent answer on that delete means this case; retrying the delete alone does not help. Until the release, the source's delete answers snapshot_has_dependents ("has 1").

Deleting a restore target: its first cut compares every restored chunk locally, so it reads the target's whole filled size. The server bounds one request at 5 minutes: pass --timeout 5m for a large target. An outcome_unknown answer there means the volume has stopped I/O while its holder settles the outcome in the background; it resumes serving when that settles (the holder logs it), and nothing acknowledged is lost. Then retry the delete with --timeout 5m. The first cut must read the filled size within one 5-minute request, so the filled size divided by your disk's read rate must fit in it; see the v1.0.1 Known limits.

Standalone deployment: snapshots, restore and space:

  • scheduled and manual snapshots;
  • deleting snapshots, and getting space back:
    • the holder's cleaning removes the chunks that no snapshot, restore target or current image names, right after a snapshot delete made by the holder itself (the schedule's retention) and every --chunk-maintenance-interval (1 hour by default); a snapshot deleted with ops chunk snapshot-delete is cleaned at the next pass;
    • then the asynchronous SeaweedFS vacuum compacts the volume files;
  • restoring a snapshot into a new volume, which reads the chunks it has not made local from that snapshot (fork is not supported in this release).

A volume holds at most 10 snapshots. The next one is refused with snapshot_limit (HTTP 409, not retryable; at most 10 per volume; delete a snapshot, or let retention prune) and nothing changes: no snapshot, no cut, HEAD as it was (TestChunkSnapshotPastTheLimitIsRefusedWithHEADUnchanged). Delete a snapshot, or let retention prune, then take it again. A scheduled snapshot refused this way still publishes the volume's image by an ordinary cut, and GET STATUS/status/durable?volume=<id> shows Chunk.ScheduledSnapshot.lastFailure.code: snapshot_limit, then snapshot_overdue (TestScheduledSnapshotAtTheLimitStillPublishes).

A snapshot can be refused with host_slot_busy / no background slot (retryable) while every host slot is held by other volumes' cuts; retry with the same request id. With many volumes on a host, a snapshot may wait for a slot: measured up to 15 s at 32 volumes with the default 3 slots.

A snapshot can answer head_conflict (HTTP 409, retryable): another write to the volume's HEAD, such as a snapshot delete, landed during its commit. Retry it with the same name. In this release, if that retry answers internal snapshot "NAME" of VOL is not in HEAD after its commit, retry once more. The volume's data is committed either way; the snapshot name exists only after a request for it succeeds (check with sw-block ops chunk snapshots) (TestKnownDefectSnapshotRetryAfterAGenuineConflictCommitsTheDataUnnamed). A retry that names the snapshot at once is planned for a later release.

A snapshot delete can answer head_conflict (HTTP 409, retryable) too: another write to the volume's HEAD, such as the holder's cleaning beginning, landed between the delete's read of HEAD and its write. Nothing of the delete applied; retry it (TestSnapshotDeleteRacedByACleanBeginIsAHeadConflict).

A snapshot's time grows with the data changed since the volume's last cut. sw-block ops chunk snapshot waits 60 s by default, so pass --timeout above the expected time; the server bounds one request at 5 minutes whatever --timeout says. A request that runs out of time answers a retryable code: remote_unavailable or deadline_exceeded when it ran out before its commit, outcome_unknown when it ran out during the commit. Before the commit, the name is withdrawn and no later cut publishes it; the volume's data is unchanged and stays queued for the next cut. After outcome_unknown, the commit may have landed with the name. Rerun the snapshot with the same name and a larger --timeout: a name already in HEAD is answered with the snapshot it names, so a rerun never takes a second one. A rerun keeps what a timed-out request already uploaded: it finds those chunks and sends only the rest. A large change can need more than one 5-minute request. With a --timeout above 5 minutes (for example --timeout 15m), sw-block ops chunk snapshot, cut and detach repeat the 5-minute request with the same body until it answers or the timeout ends; with a shorter one, rerun until it answers. A scheduled snapshot retries by itself (after 1 minute, doubling to 1 hour).

With --host-limit-dir set (it is off by default), uploads are paced at --host-limit-upload-bytes-sec (64 MiB/s by default) shared by the host's 4 slots, about 16 MiB/s per volume. Only the bytes a cut sends are paced: a chunk already stored is not. A cut or snapshot with more than about 4.7 GiB changed does not finish within the 5 minutes; rerun it, and each rerun sends only the chunks not yet stored. In 1.0.0 the pacing was charged for stored chunks too, so such a rerun did not finish either.

Moving a volume, and returning it

Volume lifecycle:

  • the planned hand-over to another host or back to the same host;
  • restarts inside and after the lease;
  • the forced move when a host is lost, with the lost range;
  • which of these procedures run end to end, and which do not.

Replicated volumes (preview)

Replicated volumes (replication_factor above 1) are a preview in v1.0. In the acknowledging modes (sync-quorum, sync-all) they keep acknowledged data. The default best-effort acknowledges a write with no replica, and a best-effort volume is not failed over automatically: blockmaster holds it, and only the operator's forced failover (sw-block ops failover) moves it, which may lose the writes acknowledged last. Under a writing guest a single fault can stop writes until an operator acts. The limits, as they show on a running system:

  • No snapshots, restore, moves or object-store copy. v1.0 has two designs: the single-replica volume with the object store (--durable-impl walstore-chunk: snapshots, restore, moves) and replicated volumes on local stores without any of those. walstore-chunk refuses replication at start (--durable-impl=walstore-chunk is single-replica: --replication-ack="sync-quorum" needs replica peers (...)) and refuses any assignment with replica slots, because a chunk snapshot takes its position from the local log, which the replicas may not hold.

  • A replica that misses writes is not caught up by itself. While the guest writes, the primary keeps only a few write-ahead-log entries beyond its last checkpoint. A replica that falls behind them (it was restarted, or a failover fenced it) needs a rebuild, and a rebuild onto the data it already has is refused (re-add with a retained base is not supported in v1). The replica stays out (degraded) until it is wiped and added again. --wal-retention-lsns does not help in this release: with it set, a lagging replica still always needed a rebuild.

    • Wipe and add again (not a tested procedure in this preview): first confirm from the primary's status which server is the left-out replica; never run this on the primary's host. On the replica's host, stop its blockvolume unit, and remove that volume's data files from its --durable-root: <vol>.bin, every <vol>.bin.* and <vol>.epoch-table, where <vol> is the volume id. This needs a --durable-root that holds this volume only (a dedicated directory per replica): in a shared root those names can match another volume's files, so do not use this repair there. Keep <vol>.replica-floor (an authority fence; keeping it only refuses more). Then start the unit again with the same flags. It then starts empty and takes a full rebuild from the primary; until that ends, the primary's status lists it as not healthy, and the volume keeps serving while the remaining replicas meet the ack mode.
    • If the re-add stops midway (the rebuild is interrupted), the replica refuses every later rebuild: wipe it and add it again.
  • A durability shortfall is an immediate I/O error, not a wait. When the replicas that must acknowledge a write cannot (sync-quorum: a quorum; sync-all: every replica), the write fails at once and the guest gets EIO. With three replicas and sync-quorum, one replica left out as above plus one more fault loses the quorum; a single failover can already leave too few replicas, depending on timing.

  • sync-all refuses every write while any replica is down. It needs every replica for each write.

  • Under best-effort (the default), a replica can fall behind while it shows healthy. A best-effort write waits for no replica, so a replica whose connection dropped can keep showing healthy in the primary's status while it misses writes. Use sync-quorum when the replicas must hold the data.

  • No path failover in the guest. A guest connects to one target, and a target that is no longer the primary answers with a status the guest does not retry: its I/O fails with EIO instead of moving to another path. There is no multipath for replicated volumes in v1.0; after a failover the guest is started on the new primary's host (see host connect settings).

  • The same holds on Kubernetes for RF3 volumes. This preview has no remedy for a pod-backed replica that is left out: it stays out, and the volume serves while the remaining replicas meet the ack mode.

In the acknowledging modes, acknowledged writes were read back intact in every run that found these limits. What the release supports without these limits is the single-replica volume.

Planned for a later release. Supported replicated volumes are planned for a later release; v1.0.1 keeps every replicated configuration a preview. Replicated volumes are a preview: a primary cut off from the block master is not stopped by a lease and may serve stale reads to a guest still connected to it; do not use replicated volumes for data you cannot lose.

When a host is lost

The steps below are for a single-replica volume. A sync-quorum or sync-all replicated volume under --cluster-spec with the lifecycle loop on is failed over by blockmaster itself when its primary's heartbeat goes stale and enough replicas answer the fencing round; the operator's sw-block ops failover is for when that round cannot decide, and for a best-effort volume, which is never failed over by itself (see replicated volumes in this release).

  1. Make sure the lost host stays down for this volume. The product does not power off an old holder.
    • If it comes back after the move, blockmaster refuses its lease: it does not serve, logs exiting status=78 reason=moved and exits 78, and the example unit does not start it again (TestProcedureForcedMoveWithTheOldHostReturning).
    • Stop and disable that unit on the old host. Run systemctl reset-failed only after you have dealt with its local root (do not).
  2. Run the forced move to another registered node: --dry-run first, then the move. See the holder never comes back.
    • It is admitted after the barrier: at most 65 s after the holder stopped, with default flags.
  3. Read the printed lost range: writes acknowledged after the last cut and before the move's time may be lost.
    • Read it again later with sw-block ops workspace lost-range.
  4. Start blockvolume on the new node, then reconnect the guest.

Read-only store verification

Use sw-block ops chunk verify --master MASTER --volume V --chunk-filer FILER to resolve the logical name through blockmaster. To inspect an offline store, omit --master and pass its explicit <name>-<id8> directory as --volume. See verification options and exit codes.

Host connect settings

The guest's kernel keeps an NVMe/TCP controller whose target went away and keeps reconnecting to the same address. Three nvme connect options decide how long it waits and what the guest sees meanwhile. The values below are derived from the waits these pages state, and were run with exactly these options (below).

Option Kernel default Set it to Why
--ctrl-loss-tmo 600 s 180 Longer than the longest wait for the same target to serve again: a restarted holder is re-granted at most 65 s after it stopped; a start not granted within 30 s after that barrier ends its wait, and the unit starts it again after RestartSec=5s (after a crash): 65 + 30 + 5 = about 100 s
--reconnect-delay 10 s 2 The controller retries every 2 s; connection setup and the network add to it. Linux bounds the retries by count, not by time: --ctrl-loss-tmo / --reconnect-delay = 90 attempts
--fast_io_fail_tmo off leave off Any value shorter than the wait above fails I/O to the filesystem before the target serves again
sudo nvme connect -t tcp -a 127.0.0.1 -s 4420 -n "$NQN" --ctrl-loss-tmo=180 --reconnect-delay=2

What the guest sees:

  • These values, holder process stopped (its host up, so a connect attempt is refused at once; the case a standalone guest meets, since it connects over loopback to the holder on its own host): I/O waits and continues when the target serves again. Measured with exactly these options: the holder killed, a write issued, the holder started again 5 s later (as the unit would): the write completed after 6.1 s, with no error. Kept away, the write failed with EIO after 181.5 s (90 attempts, 2 s apart).
  • These values, host powered off or unreachable (nothing answers, so each attempt waits for the connect timeout, about 3 s; the case of a guest on another host than the holder, which in v1 is a Kubernetes pod): the loss is noticed by keep-alive (5 s), then the 90 attempts take about 5 s each. Measured: a pending write failed with EIO after 464 s, about kato + 90 × (2 s + the connect timeout).
  • Kernel defaults (ctrl_loss_tmo 600 s, reconnect_delay 10 s: 60 attempts; every connect command shipped today, including the CSI node): a target that does not come back holds I/O for about 600 s when its host refuses the connection (in one fault run two reads blocked for 552 s and 614 s, about 9 and 10 minutes, then failed with EIO), and for about 60 × (10 s + 3 s), some 13 minutes, when its host is unreachable (derived from the attempt count and the per-attempt connect timeout measured above; not run).
  • Too short (--ctrl-loss-tmo or --fast_io_fail_tmo below the wait): I/O errors reach the filesystem before the target serves again; ext4 mounted with errors=remount-ro turns read-only and must be remounted.

A blockmaster outage longer than the lease stops the holders: a holder keeps serving until its lease ends (up to 20 s after its last renewal) and serves again at least 50 s after blockmaster is back (what a blockmaster restart does to serving volumes). Guest I/O therefore waits at least the rest of the outage plus those 50 s; these pages give no upper bound. An outage longer than --ctrl-loss-tmo less those 50 s can fail guest I/O. Raise --ctrl-loss-tmo if the guest must ride through longer outages; I/O waits that long.

After a failover the guest must connect to the new primary. These options retry the configured address; they never redirect it. A standalone volume's NVMe/TCP target binds loopback only (--nvme-listen; a non-loopback bind needs --allow-external-nvme-bind, unauthenticated, for test gates only), so a guest reaches only the target on its own host. Each replica's target reports itself optimized only while it is the healthy primary, but no guest is connected to the other replicas' targets. A replicated sync-quorum volume gets its new primary on another host about 30 to 35 s after its host is lost, with default flags (derived from --freshness-window and the two probe rounds; not yet measured). In a standalone deployment the guest runs on the volume's primary host. If the host is lost, the guest goes down with it; if only its holder stopped, the guest's I/O waits and then fails as above (or completes if the holder restarts first). Either way, after a failover start the guest on the new primary's host and connect it there: that host's blockvolume logs adopted as PRIMARY and its /status?volume=<id> shows "AuthorityRole":"primary".

Kubernetes. The CSI node stages iSCSI by default (protocol: iscsi). With protocol: nvme it connects with a plain nvme connect and the kernel defaults, and then (NVMe/TCP only) a pod whose holder does not come back holds I/O for about 600 s when the holder's node is up, and some 13 minutes when the node is powered off or unreachable (derived as above): its reads and writes block (processes in uninterruptible sleep, probes that touch the volume time out), then fail. Recovery is by recreating the pod, which stages the volume again on the current primary (operations). The CSI node passing the settings above is planned for a later release.

A volume waiting for blockmaster

A blockvolume that cannot get its lease from blockmaster waits inside its process: the unit stays active and the volume does not serve. A monitor that only watches for failed units does not see it.

  • /status shows NotReadyReason=lease_not_held and MasterWait with Reason, SinceMs and, when the wait has a bound, UntilMs; the process logs blockvolume: waiting for the master: <reason> ... when the reason changes and every 10 minutes.
  • Alert when the reason is unreachable, credentials or identity refused: ... for more than 60 s, and on any reason for more than 5 minutes.
  • identity refused: unregistered or wrong_host: blockmaster does not know the unit's --server-id, or the node calls from another address than the one registered for it in the cluster spec. The check compares the address exactly: an address change, another outgoing interface, IPv4 against IPv6, or a host name in the cluster spec all refuse the right host. Fix the address: a cluster-spec edit takes effect after a blockmaster restart, and a change to the unit's flags after that unit restarts. Once the master's records match, the waiting unit's next call passes without a restart of its own.
  • workspace bindings uncertain; restart required, workspace durable store unavailable or uncertain, or a move with an UNKNOWN outcome: a write of blockmaster's workspace record or binding store had an unknown outcome. Blockmaster keeps that uncertainty in memory only and refuses every renewal, move and delete of the volume, so its holder cannot keep its lease and restarts (exit 75) again and again. Nothing but a blockmaster restart clears it: once the store answers again, restart blockmaster; it reads the record back and serves the volume again.

Limits

  • One filer per chunk store. It is a single point of availability for cuts, snapshots and moves.
  • No guest freeze. Snapshots and seals are crash-consistent only.
  • Setup: a --topology-only setup cannot move a volume at all. The cluster spec with a lifecycle store is required.
  • One node: with one node in the cluster spec, a revoke not followed by an ACK cannot be undone.
  • Unauthenticated control endpoint. --chunk-control-endpoint has no authentication; keep it on loopback.
  • Destructive SeaweedFS commands. Never run SeaweedFS volume.fsck with its delete flags on a cluster holding chunk volumes (why).
  • One live process per volume per host. The host lock keeps two processes for one volume apart only on one host; two hosts are kept apart by the assignment and the lease. A container needs the host's /run/sw-block/locks (one process per volume).
  • Cleaning is on by default. The holder removes chunks no root names right after a snapshot delete made by the holder itself (the schedule's retention) and every --chunk-maintenance-interval (default 1 h). A snapshot deleted with ops chunk snapshot-delete is cleaned at the next pass, so its space can take up to that interval to return; when freeing space on a full store, allow for it. --chunk-maintenance-gc=false turns it off, and then nothing removes them. The disk space returns when SeaweedFS vacuums its volumes.
  • Node reattach events under mutual TLS. Node reattach events are not recorded in the cluster event log under mutual TLS: a CSI node's certificate is viewer, so blockmaster refuses the event and the node logs one line per reattach.

Commands and their tests

Every command on the pages above, and the test that runs it.

  • "binary": the test runs the real binaries (build tags subprocess chunkstore_integration).
  • "CLI": the test drives the sw-block command with its flags.
Command Test Kind
blockmaster ... --cluster-spec ... --lifecycle-store ... --workspace-rpc ... TestStandalonePlannedHandoffToTheSameHost (cmd/blockvolume) binary
blockmaster ... --cluster-spec ... --expected-slots-per-volume 3 --lifecycle-product-loop-interval ... (a replicated volume) TestDoubleFailoverReadsBackEveryAckedWrite, TestFencingRoundHealContinuesThePrimary (cmd/blockvolume, run with 200ms) binary
blockvolume ... --durable-impl walstore-chunk ... --workspace-lease ... same binary
sw-block ops workspace show, revoke --sealed-gen, move --clean same binary
sw-block ops chunk detach --plain, chunk show, chunk cut same; TestProcedureForcedMoveWithTheOldHostReturning binary
sw-block ops workspace force-move [--dry-run], lost-range TestProcedureForcedMoveWithTheOldHostReturning, TestProcedureRevokeWithoutACKThenForcedMove binary
sw-block ops volume-unheld --path cmd/sw-block/volume_unheld_test.go CLI
sw-block ops chunk snapshot, snapshots, snapshot-delete cmd/sw-block/chunk_test.go CLI
sw-block ops chunk restore --source --snapshot --target [--request-id] cmd/sw-block/chunk_b_test.go CLI
sw-block ops failover cmd/sw-block/failover_test.go CLI
Certificate issuance and rotation (openssl above) not run in 1.0 as written not run
curl STATUS/status?volume=v1 the status checks in the binary tests above binary
nvme connect, nvme list, nvme disconnect not run here: the binary tests use an NVMe/TCP host inside the test not run
blockvolume under systemd: exit 75 after an expired start, restart, re-grant TestSystemdExpiredStartupExits75ThenRegrantServes (cmd/blockvolume, a real systemd manager, tag systemd_integration) binary
The shipped units' start limits (StartLimitIntervalSec=600, StartLimitBurst=10, RestartPreventExitStatus=78) TestBlockvolumeUnitsBoundStartupRetries (internal/testops, reads the unit files) unit files
systemctl enable, stop, disable, reset-failed, systemd-tmpfiles --create as written on these pages not run: the tests above start transient units, not the installed ones not run
Headroom refusal at create, and both ways out (free space; --durable-root on a file system with room) TestHeadroomRefusesRestoreTargetsThenServesThem, TestHeadroomRefusedTargetBlastRadiusAndAnotherRoot, TestHeadroomRefusedRestoreTargetKeepsItsSourceSnapshot (cmd/blockvolume, root, loop-mounted file systems) binary
A snapshot refused with host_slot_busy / no background slot while every host slot is held, retried with the same request id TestSnapshotLadderF1VolumesOneHost (cmd/blockvolume, F1_RUN=1, F1_HOST_LIMIT_DIR set, 3 slots; F1_SLOT_RETRY_SECONDS=0 is its negative control) binary
Full local disk; full --host-limit-dir TestProcedureLocalDiskFull (cmd/blockvolume, root, testdata/diskfull.sh); what a Linux guest sees: TestProcedureLocalDiskFullKernelInitiator (kernel NVMe/TCP host) binary
A first start with the wrong --durable-blocks: refused before any local store is created (exit 78) TestWrongGeometryFlagIsRefusedBeforeTheStoreIsCreated (cmd/blockvolume) binary
A first start over a corrupt volume record: exit 78 before any local store is created; a start once the record is restored TestCorruptRecordIsRefusedBeforeTheStoreIsCreated (cmd/blockvolume) binary
A wrong-size local store left by an earlier release (geometry_mismatch at attach): the guard (sw-block ops chunk show), removing the local files, a start with the right flags TestWrongGeometryCureAsWritten (cmd/blockvolume; the store is planted from a capture of such a run) binary
SeaweedFS (filer or volume server) down during a cut TestProcedureStoreDownDuringACut (cmd/blockvolume) binary
blockmaster refuses a --workspace-max-clock-skew whose half does not exceed its fence-exit budget (at or below 10.1 s) TestBlockmasterRefusesASkewBoundAtOrBelowTheFenceExit (cmd/blockvolume, tag subprocess) binary
The missing lock directory (host volume lock directory unavailable) and its cure (tmpfiles entry or chown) not run in 1.0 not run
First volume (read-only check): swb_start, swb_show, swb_stop not run in 1.0 (needs sudo and the kernel NVMe/TCP host) not run
Write test: scripts/run-nvme-os-smoke.sh not run in 1.0 not run
Upgrade order: blockmaster first, then blockvolume not run in 1.0 (no mixed-version run) not run
Scheduled snapshots (--chunk-snapshot-schedule) on a running volume with a real clock not run in 1.0 as written: the schedule is tested with a fake clock (core/frontend/durable/chunk_snapshot_schedule_test.go) not run
Periodic capture (--chunk-capture-interval) on a running volume a lab run on the release candidate: automatic cuts while the guest wrote, every acknowledged write read back lab
SeaweedFS vacuum (/vol/vacuum, volume.vacuum) not run in 1.0: a SeaweedFS command; the tests check that the cleaning deletes the chunks, not that SeaweedFS compacts its files not run