Files
seaweedfs/seaweed-block/docs/operations-manual.md
T

1150 lines
74 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Operations manual (v1.1.x, standalone walstore-chunk volumes)
This manual takes one host from nothing to a serving volume. It then covers snapshots, restore, stop, delete,
upgrade and monitoring, all with systemd. Every step gives the command to run. Links are for background only; you
should not need them to finish a step. They are relative to the repository's `docs/` directory.
The examples use one host, with everything on loopback. Where an address must change for several hosts, the step
says so. For the Kubernetes alpha line, see the [Kubernetes quick start](quickstart-kubernetes.md).
**Conventions:**
- **Absolute paths under sudo.** Every command run with `sudo` names its binary by absolute path
(`sudo /usr/local/bin/sw-block ...`). On RHEL and its rebuilds, sudo's `secure_path` does not include
`/usr/local/bin`, so `sudo sw-block` answers `command not found`. Commands without sudo use the short name.
- **Device names.** `/dev/<device>` stands for a device name you read from `lsblk` on your host. Never copy a device
name from an example.
- **Addresses.** `<A-IP>` and `<B-IP>` mean the private, mutually reachable addresses of your two hosts, read from
`ip -br addr` and checked against your network configuration. Replace these markers before running a command or
writing a file; they are not shell variables. `127.0.0.1` always means the host running that command. The
two-host procedure and each address's purpose are in [appendix B](#appendix-b-two-hosts-and-a-planned-move).
Contents:
0. [Prerequisites](#0-prerequisites)
1. [Install the binaries and units](#1-install-the-binaries-and-units)
2. [Cluster spec and blockmaster](#2-cluster-spec-and-blockmaster)
3. [Create and attach a volume](#3-create-and-attach-a-volume)
4. [Stop a volume](#4-stop-a-volume)
5. [Snapshots, restore and verification](#5-snapshots-restore-and-verification)
6. [Delete a volume](#6-delete-a-volume)
7. [Upgrade and finalize the v1.1 format](#7-upgrade-and-finalize-the-v11-format)
8. [Isolation: one I/O share per process](#8-isolation-one-io-share-per-process)
9. [Monitoring](#9-monitoring)
10. [Typed errors and what to do](#10-typed-errors-and-what-to-do)
11. [Known limitations](#11-known-limitations)
12. [Remove everything](#12-remove-everything)
Appendix A. [Build from source](#appendix-a-build-from-source)
Appendix B. [Two hosts and a planned move](#appendix-b-two-hosts-and-a-planned-move)
## 0. Prerequisites
This manual has been run end to end on Ubuntu 24.04 and on AlmaLinux 9 with SELinux enforcing. You need Linux with
systemd and root access.
1. **Packages.** You need the guest initiator, synced clocks, git and curl:
```sh
# Ubuntu / Debian
sudo apt-get update && sudo apt-get install -y nvme-cli chrony git curl xfsprogs
sudo apt-get install -y open-iscsi # iSCSI guests only
# Ubuntu cloud kernels (azure, aws, gcp) ship nvme_tcp in a separate package:
sudo apt-get install -y linux-modules-extra-$(uname -r) # if modprobe says "Module nvme_tcp not found"
# RHEL 9 / AlmaLinux 9 / Rocky 9
sudo dnf install -y nvme-cli chrony git curl tar
sudo dnf install -y iscsi-initiator-utils # iSCSI guests only
# both (harmless on an iSCSI-only host)
sudo modprobe nvme_tcp
echo nvme_tcp | sudo tee /etc/modules-load.d/nvme_tcp.conf # load it at every boot
```
Lease safety needs bounded clock skew between hosts, and blockmaster's clock must be slewed, never stepped,
while volumes are served ([clock safety](operator-guide.md#clock-safety-requirement)). Configure chrony to step
only during its first updates at boot: `makestep 1 3`. Ubuntu ships that. EL9 ships `makestep 1.0 -1` (it may
step at any time), so change it on RHEL hosts before blockmaster starts:
```sh
grep '^makestep' /etc/chrony.conf /etc/chrony/chrony.conf 2>/dev/null # want: makestep 1 3
sudo sed -i 's/^makestep .*/makestep 1 3/' /etc/chrony.conf # EL9
sudo systemctl restart chronyd
```
On a cluster that already serves volumes, make this change only while no volume is served: do not restart
chronyd while leases are live.
2. **A SeaweedFS 4.53 cluster with exactly one filer.** A volume keeps its chunks in SeaweedFS, through the filer's
gRPC port (18888 by default). You need one master and one filer; a second filer is refused. For a single-host
trial, install `weed` and run it as a systemd unit:
```sh
curl -fsSLO https://github.com/seaweedfs/seaweedfs/releases/download/4.53/linux_amd64.tar.gz
curl -fsSLO https://github.com/seaweedfs/seaweedfs/releases/download/4.53/linux_amd64.tar.gz.md5
md5sum linux_amd64.tar.gz; cat linux_amd64.tar.gz.md5 # the two sums must match
tar -xzf linux_amd64.tar.gz # extracts ./weed
sudo install -m 0755 weed /usr/local/bin/weed
sudo mkdir -p /data/weed # SeaweedFS data: put it on a disk with room for the chunks
sudo tee /etc/systemd/system/seaweedfs.service >/dev/null <<'EOF'
[Unit]
Description=SeaweedFS (single host)
After=network-online.target
[Service]
ExecStart=/usr/local/bin/weed server -dir=/data/weed -ip=127.0.0.1 -filer -volume.max=200 -master.volumeSizeLimitMB=1024
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now seaweedfs
sleep 10; ss -ltn | grep -c -E ':(9333|8888|18888) ' # 3: master, filer HTTP, filer gRPC (6 with appendix B's -ip=<A-IP>)
```
`linux_amd64.tar.gz` is the plain build; the `_full` and `_large_disk` variants also work. The filer's gRPC
address is then `127.0.0.1:18888`.
3. **A disk for the volume's local data.** Each volume keeps its WAL and local copy under
`/var/lib/sw-block-volume/<volume>`. That is on the root disk by default; `--durable-root` moves it. To size the
host, see [size a host](operator-guide.md#size-a-host).
4. **This manual is for one host.** Everything listens on loopback, and nothing needs a firewall port. Two limits
apply to any layout:
- **Guests attach on the volume's own host.** A standalone volume's NVMe/TCP and iSCSI targets bind loopback only;
a non-loopback `--nvme-listen` is refused. Do not change the guest listeners to a host address.
- **blockmaster on another host needs mutual TLS.** blockmaster refuses a non-loopback `SWB_MASTER_LISTEN`
without it. Set up the certificates and roles first, as
[appendix B](#appendix-b-two-hosts-and-a-planned-move) shows; changing the address alone does not work. The holders then also reach SeaweedFS (its master, filer and volume servers) over the network.
## 1. Install the binaries and units
**Plan blockmaster's state storage before starting it.** Keep the holders' local data off both the state
directory's filesystem and the filesystem holding its ancestors. In practice, put the holders' data on its own
filesystem, not the root filesystem. With the shipped unit, the state directory is `/var/lib/sw-block-master`,
including the authority and lifecycle stores. A different directory on the same filesystem is not enough. A
dedicated state-directory mount alone does not isolate every startup sync: opening the store also syncs ancestor
directories up to `/`, including `/var/lib` and `/var` with this layout. Keep write load low on those filesystems
when restarting too. Under heavy writes, an `fsync` when blockmaster opens its state directory can wait for the
filesystem journal. In v1.1.2, startup also runs a `syncfs` for each store with changed import records on ext4, XFS,
btrfs or tmpfs (Linux 5.8 or later), which waits for every pending write on that filesystem, including the holders'
data. Starts took from about 20 seconds to over 150 seconds in our tests (one start was not ready after 2 minutes);
this is not an upper bound. A volume whose lease expires stops serving until blockmaster is back; it is then
granted again on the same holder, with its data. A forced move during that time can lose writes after the last
published HEAD (see [forced move](volume-lifecycle.md#after-a-crash)).
Restart blockmaster at low write load, including when the cluster spec has not changed. See the
[restart known issue](releases/v1.1.1.md#known-issue-blockmaster-restart-can-stall-on-a-busy-filesystem).
1. **Get the repository at the release tag, then the binaries.** The repository holds the units in `deploy/`. The
binaries are `blockmaster`, `blockvolume` and `sw-block`, all three from the same release. `TAG` is the release,
for example `v1.1.1`. Download the release tarball and check it:
```sh
TAG=v1.1.1
git clone --depth 1 --branch $TAG https://github.com/seaweedfs/seaweed-block && cd seaweed-block # git's detached-HEAD note here is expected
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 # sw-block-<TAG>-linux-amd64.tar.gz: OK
tar -xzf sw-block-$TAG-linux-amd64.tar.gz
./blockvolume --version # revision=<commit>
git rev-parse HEAD # the same commit
```
From v1.1.1 the archive is flat (`blockmaster`, `blockvolume` and `sw-block` at its top) and `SHA256SUMS` lists
only the archive. The binaries themselves are checked by `--version`: each must print the tag's commit, as
`git rev-parse HEAD` shows it. v1.1.0's archive kept the binaries in a directory: extract it with
`--strip-components=1`, then `sha256sum -c SHA256SUMS` checks all four files (v1.1.0 is
ff6b0b1bb481d22ee2abc9206bf1ef19938787f5).
Releases without a tarball (v1.0.x) take the binaries from the **release image**, which needs Docker or Podman
(`docker.io` on Ubuntu; `podman podman-docker` on RHEL):
```sh
sudo docker create --name swb-extract ghcr.io/seaweedfs/seaweed-block:$TAG
for b in blockmaster blockvolume sw-block; do sudo docker cp swb-extract:/usr/local/bin/$b .; done
sudo docker rm swb-extract
```
To build the binaries from source instead, see [appendix A](#appendix-a-build-from-source).
2. **Install them with the shipped units**, from the same directory:
```sh
sudo useradd --system --no-create-home --shell /usr/sbin/nologin sw-block
sudo install -m 0755 blockmaster blockvolume sw-block /usr/local/bin/
sudo install -d -m 0750 -g sw-block /etc/sw-block
sudo install -m 0640 -g sw-block deploy/config/*.env /etc/sw-block/
sudo install -m 0644 deploy/systemd/*.service /etc/systemd/system/
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 # /run/sw-block/locks; blockvolume needs it
sudo systemctl daemon-reload
```
The units run `/usr/local/bin/blockmaster` and `/usr/local/bin/blockvolume`, so keep that path. Use
`install`, not `mv`: with SELinux, a file moved from a home directory keeps its home label and systemd may refuse
to run it.
Do **not** enable `sw-blockvolume.service`. It is the single-volume example for the `--topology` setup, which cannot
serve a walstore-chunk volume. This manual runs each volume as the template unit `sw-blockvolume@<volume>.service`,
which `sw-block volume start` creates (section 3). `sw-blockmaster.service` is enabled in section 2.
**Upgrade order** (for later upgrades too, see section 7): the `sw-block` CLI first, then `blockmaster`, then each
`blockvolume`. A CLI works with holders of its own version and of one version older. An older CLI against a newer
holder is not supported. (The v1.0.2 notes' "CLI last" applied to upgrades within v1.0.x.)
**Authentication.** For production, set up mutual TLS for the control API ([authenticate the control
API](operator-guide.md#authenticate-the-control-api)). The examples here run on loopback without it.
## 2. Cluster spec and blockmaster
blockmaster needs two things: a cluster spec and a lifecycle store. The cluster spec lists the nodes, and each volume
with its size and home placement. A volume's record comes from the cluster spec: no command creates a volume.
1. **Write `/etc/sw-block/cluster-spec.yaml`** (as root, for example `sudoedit /etc/sw-block/cluster-spec.yaml`, or
`sudo tee /etc/sw-block/cluster-spec.yaml >/dev/null <<'EOF'` ... `EOF`). Later sections edit the same file
the same way:
```yaml
nodes:
- server_id: s1
data_addr: 127.0.0.1:9201 # this node's own data address (volume start's --data-addr); several hosts: never loopback
ctrl_addr: 127.0.0.1:9202
volumes:
- id: v1
size_bytes: 4294967296 # 4 GiB; volume start's --size must equal it
replication_factor: 1
placements:
- server_id: s1
replica_id: r1
```
```sh
sudo chgrp sw-block /etc/sw-block/cluster-spec.yaml && sudo chmod 0640 /etc/sw-block/cluster-spec.yaml
```
2. **Replace all four of these lines in `/etc/sw-block/blockmaster.env`.** The shipped file sets the first and third lines
differently, so replace them rather than adding new ones. The shipped unit turns these lines into flags.
`--topology` and `--cluster-spec` together stop blockmaster, so the topology line must be empty:
```sh
SWB_MASTER_TOPOLOGY=
SWB_MASTER_EXPECTED_SLOTS=1
SWB_MASTER_WORKSPACE_RPC=true
SWB_MASTER_EXTRA_ARGS=--cluster-spec /etc/sw-block/cluster-spec.yaml --lifecycle-store /var/lib/sw-block-master/lifecycle --chunk-filer 127.0.0.1:18888 --chunk-path /swblock/chunks
```
For example:
```sh
sudo sed -i -e 's|^SWB_MASTER_TOPOLOGY=.*|SWB_MASTER_TOPOLOGY=|' \
-e 's|^SWB_MASTER_EXPECTED_SLOTS=.*|SWB_MASTER_EXPECTED_SLOTS=1|' \
-e 's|^SWB_MASTER_WORKSPACE_RPC=.*|SWB_MASTER_WORKSPACE_RPC=true|' \
-e 's|^SWB_MASTER_EXTRA_ARGS=.*|SWB_MASTER_EXTRA_ARGS=--cluster-spec /etc/sw-block/cluster-spec.yaml --lifecycle-store /var/lib/sw-block-master/lifecycle --chunk-filer 127.0.0.1:18888 --chunk-path /swblock/chunks|' \
/etc/sw-block/blockmaster.env
sudo grep -E '^SWB_MASTER_(TOPOLOGY|EXPECTED_SLOTS|WORKSPACE_RPC|EXTRA_ARGS)=' /etc/sw-block/blockmaster.env
```
The lifecycle store must be under `/var/lib/sw-block-master`, the unit's state directory. Any other path is
read-only under the unit, and blockmaster then restarts in a loop with `read-only file system`.
3. **Start it and check:**
```sh
sudo systemctl enable --now sw-blockmaster
sudo journalctl -u sw-blockmaster -n 20 # "new cluster: format level 1 (no prior authority state ...)"
sw-block cluster format-level --master 127.0.0.1:9180 # format level 1
sw-block ops workspace show --master 127.0.0.1:9180 --volume v1 # exit 0
```
blockmaster reads the cluster spec only when it starts. After editing the spec, run
`sudo systemctl restart sw-blockmaster`. A restart that outlasts the running volumes' leases makes them fence;
follow the state-storage and low-write-load guidance in section 1 before restarting.
blockmaster must run under systemd or an equivalent restart supervisor. A node, placement
or volume lifecycle record write or recovery-directory sync failure attempts one `ERROR` naming the store,
record and error, ending with `exiting so the supervisor restarts from durable state`,
and exits with status 1. Termination is armed before logging and occurs within one second even if the log writer or its lock is blocked; a blocked sink may lose that diagnostic. It does not remain alive with a failed store. The shipped
`sw-blockmaster.service` has `Restart=on-failure` and `RestartSec=5s`; restart reloads
complete records through the recovery barriers before serving again.
Deletion-reservation and workspace-binding write failures do not exit: the request returns
the error and blockmaster keeps serving. A deletion reservation whose write outcome is unknown
keeps a new exclusion in memory. A workspace-binding rename or directory-sync failure leaves
the binding store uncertain, and every later binding operation fails with `restart required`
until `sudo systemctl restart sw-blockmaster`.
## 3. Create and attach a volume
1. **Add the volume to the cluster spec** with its `size_bytes` (edit it as root, as in section 2), and restart
blockmaster. Check it with
`sw-block ops workspace show --master 127.0.0.1:9180 --volume <volume>` (exit 0). (For a restore target, which has
no `size_bytes`, the same command exits 1 with `workspace move requires an existing RF1 volume` until the restore.
That is expected.)
2. **Start it.** It needs root, and `--size` must equal the spec's `size_bytes`:
```sh
sudo /usr/local/bin/sw-block volume start v1 --server-id s1 --replica-id r1 \
--data-addr 127.0.0.1:9201 --ctrl-addr 127.0.0.1:9202 --status-addr 127.0.0.1:9203 \
--size 4GiB --nvme-listen 127.0.0.1:4420 --chunk-filer 127.0.0.1:18888
```
For an **iSCSI** guest, add `--iscsi-listen 127.0.0.1:3260 --iqn iqn.2026-12.io.seaweedfs:v1`.
`--nvme-listen` stays required: the volume serves both protocols. With SELinux enforcing, `iscsid` may connect
only to ports labeled `iscsi_port_t` (3260 by default). For any other iSCSI port, label it **before discovery**:
```sh
sudo dnf install -y policycoreutils-python-utils
sudo semanage port -a -t iscsi_port_t -p tcp <port>
```
The command does four things:
- writes `/etc/sw-block/volumes/v1.env`;
- starts `sw-blockvolume@v1.service`;
- waits until the volume is Healthy (2 minutes by default);
- prints the attach command. (Its hints say `sudo sw-block ...`; on RHEL, use `sudo /usr/local/bin/sw-block ...`.)
Running it again with the same flags answers `unchanged`. Different flags are refused
(`exists with other settings ... pass --replace`).
3. **Attach the guest.** For NVMe/TCP, use the command the start printed:
```sh
sudo nvme connect -t tcp -a 127.0.0.1 -s 4420 -n nqn.2026-05.io.seaweedfs:v1 --ctrl-loss-tmo=180 --reconnect-delay=2
lsblk -o NAME,SIZE,MODEL # the new 4G device, model "SeaweedFS V3 BlockVol"
```
For iSCSI:
```sh
sudo iscsiadm -m discovery -t sendtargets -p 127.0.0.1:3260
sudo iscsiadm -m node -T iqn.2026-12.io.seaweedfs:v1 -p 127.0.0.1:3260 --login
lsblk -o NAME,SIZE,VENDOR,MODEL # the new 4G sd device, vendor "SeaweedF", model "BlockVol"
```
- **iscsid and the initiator name.** `iscsid` starts on first use, and it creates `/etc/iscsi/initiatorname.iscsi`
then. You don't need to enable or configure either.
- **Boot.** Discovery records the target with `node.startup = automatic`, so the initiator logs in again at boot,
possibly before the volume serves. To log in yourself once the volume serves, set it to manual:
`sudo iscsiadm -m node -T iqn.2026-12.io.seaweedfs:v1 -p 127.0.0.1:3260 --op update -n node.startup -v manual`.
- **Telling volumes apart.** With several volumes attached, find each device by its name instead of by order.
For iSCSI, run `ls -l /dev/disk/by-path/ | grep <iqn>` (for example `...:3261-iscsi-iqn...:v2-lun-0 -> ../../sdc`).
For NVMe/TCP, run `sudo nvme list-subsys`, which shows each NQN with its controller.
4. **Make a filesystem and mount it.** Run `mkfs` only the first time: it erases the volume.
```sh
sudo mkfs.xfs /dev/<device> # or mkfs.ext4
sudo mkdir -p /mnt/v1 && sudo mount /dev/<device> /mnt/v1
```
Sizes and start time:
- **Size limit.** New volumes can be up to 1 TiB (1,099,511,627,776 bytes) once the cluster is at format level 1.
New clusters start there; an upgraded cluster gets there with the finalize (section 7).
- **Large volumes before the finalize.** A volume above 256 GiB in the cluster spec is **not registered**.
blockmaster logs `size_requires_format_level_1 ... finalize the v1.1 format` and keeps running without it. Check
blockmaster's log after adding a large volume. (`sw-block ops volume create` answers the same refusal with exit 78.)
- **Start time.** It grows with size:
- attach takes about 1.4 ms per GiB (about 4 s at 1 TiB);
- a restart after a kill takes about 1.5 ms per GiB (about 2.1 s at 1 TiB).
Both are inside the 30 s startup window.
- **`--recover-timeout`** (default 30 s) is a no-progress window, not a total deadline. Each completed recovery step
renews it, and it pauses while the volume waits for blockmaster. A full window without progress reports
`recovery_stalled` (section 10).
- **One live process per volume per host.** A host lock keeps a second process for the same volume out. The
assignment and the lease keep two hosts apart.
## 4. Stop a volume
```sh
# NVMe/TCP guest
sudo umount /mnt/v1
sudo nvme disconnect -n nqn.2026-05.io.seaweedfs:v1
sudo /usr/local/bin/sw-block volume stop v1
```
```sh
# iSCSI guest
sudo umount /mnt/v1
sudo iscsiadm -m node -T iqn.2026-12.io.seaweedfs:v1 -p 127.0.0.1:3260 --logout
sudo /usr/local/bin/sw-block volume stop v1
```
While a guest is connected, the stop refuses with exit 2 (`guests: 1 guest connection(s) ... disconnect them
first`). Otherwise it:
1. takes a cut, so the object store has every write up to now;
2. stops the unit;
3. ends with `recovery point in the object store: the cut at <time>` (exit 0).
A stop prints its mode. With this host's live binding, it performs a clean release and retains that binding; `sudo /usr/local/bin/sw-block volume start v1 ...` with the same flags obtains epoch+1 through a same-host clean move before enabling the unit. No admin preparation is needed between stop and start. A direct unit restart cannot reuse the released old epoch (exit 79). A lost-answer rerun uses the master's visible grant without resending the move. Without a binding for this host, stop uses the v1.1.0 path (cut, unit stop, no revoke), and start uses the existing line after checking the master-reported owner. START reads the master's current-holder fact, never infers ownership from prepared bindings. An unknown/inconsistent owner or a volume served elsewhere is refused without force advice. A revoked bound line without its recorded ACK is refused with exit 2; only a proven local owner gets an explicit force-move command and the warning that it may lose writes after the last published HEAD. Start never forces automatically. During a CLI-first upgrade, a successful reply from the preceding master version omits the current-holder, never-published and owner-unreadable markers. Start and stop use the legacy path then: cut and unit stop without a new revoke, and start on the existing authority path. A new master sets owner-unreadable when it cannot prove the current owner; automatic start/release refuse, while repair and read-only queries keep the full status. An operator who independently knows the correct host must select any forced move's `--target-host`; START does not select it. See [ownership observation](design/volume-start-ownership.md).
A successful `volume stop` disables the unit so it stays stopped across reboot. `volume start` enables it again. If disabling fails after the unit stops, stop returns an error and asks for a rerun.
Running the stop again on a stopped volume answers `not running (inactive): nothing to cut or stop` (exit 0). When
you know no guest uses the volume (for example, a killed VM), add `--force`.
**blockmaster and the holders on one host.** A holder that loses blockmaster for about 20 s loses its lease. It
exits 75 and systemd restarts it 5 s later. From v1.1.1 the volume unit orders after blockmaster without starting it,
so a blockmaster stopped on purpose stays stopped. A v1.1.0 unit `Wants=` blockmaster, so that restart starts a
stopped blockmaster again: on v1.1.0, to keep blockmaster down for maintenance, stop the volumes on that host first.
## 5. Snapshots, restore and verification
**Take a snapshot.** Snapshots are crash-consistent; there is no guest freeze.
```sh
sw-block ops chunk snapshot --volume v1 --name snapA --status-addr 127.0.0.1:9203 --request-id snapA-1
sw-block ops chunk snapshots --volume v1 --master 127.0.0.1:9180 --chunk-filer 127.0.0.1:18888
```
`sudo /usr/local/bin/sw-block volume backup v1 --name bk1` takes the same kind of snapshot through the volume's unit.
- **Scheduled snapshots.** Holders take them by default, so a `sched-...` snapshot also appears.
- **`chunkCount`.** v1.1.0 does not fill this field of the answer; it is always 0. v1.1.1 omits the field. To count
a volume's chunks, run verify (below).
- **Repeating a request.** The same name with a new request id is refused (`snapshot_exists`, exit 1). The same
request id replays the first answer.
**Restore a snapshot into a new volume.** The source keeps serving. Use the two steps below.
(`volume backup` also prints a one-command `sw-block volume restore`. That command needs blockmaster's lifecycle
product loop, which this setup does not run.)
1. **Add the target to the cluster spec without `size_bytes`** (edit it as root, as in section 2), then restart
blockmaster. An entry with
`size_bytes` creates an empty volume, and the restore is then refused with `target_exists`. A target missing from
the spec is refused with `not_admitted`.
```yaml
- id: v2
replication_factor: 1
placements:
- server_id: s1
replica_id: r1
```
Add a target only when you are about to restore into it. In v1.1.0, an entry removed again before any restore
leaves its placement behind (section 6).
2. **Restore, then start the new volume with the source's size.** On the same host it needs its own ports:
```sh
sw-block ops chunk restore --master 127.0.0.1:9180 --source v1 --snapshot snapA --target v2 \
--chunk-filer 127.0.0.1:18888 --request-id restore-v2
sudo /usr/local/bin/sw-block volume start v2 --server-id s1 --replica-id r1 \
--data-addr 127.0.0.1:9211 --ctrl-addr 127.0.0.1:9212 --status-addr 127.0.0.1:9213 \
--size 4GiB --nvme-listen 127.0.0.1:4421 --chunk-filer 127.0.0.1:18888
```
For iSCSI, add `--iscsi-listen 127.0.0.1:3261 --iqn iqn.2026-12.io.seaweedfs:v2`.
3. **Attach it** as in section 3, but do **not** run `mkfs`: the data is the snapshot's.
- **XFS next to its source.** The restored filesystem has its source's UUID, so mount it with
`sudo mount -o nouuid /dev/<device> /mnt/v2`.
- **SELinux and iSCSI.** Label the new port (3261 here) before discovery, as in section 3:
`sudo semanage port -a -t iscsi_port_t -p tcp 3261`.
**Verify a store** read-only:
```sh
sw-block ops chunk verify --master 127.0.0.1:9180 --volume v1 --chunk-filer 127.0.0.1:18888 --orphans
sw-block ops chunk verify --master 127.0.0.1:9180 --volume v1 --chunk-filer 127.0.0.1:18888 --depth data --timeout 10m
```
- **Exit codes:** 0 complete and clean; 3 complete with findings; 1 incomplete operational/unknown answer; 2 usage or server argument refusal; 4 unproven integrity readout; 5 authentication rejection; 75 unsent/retryable remote failure; 78 local credential/configuration failure. An incomplete scan never exits 3; inspect its JSON `code` and partial `verify` result.
- **`--depth data`** needs `--timeout`.
- **`--timeout` and `--deadline`.** `--timeout` is a no-progress window: each completed read renews it.
`--deadline` optionally bounds the whole pass.
- **ORPHAN findings.** `--orphans` can exit 3 with `ORPHAN` findings ("no reachable root names it") on a healthy
volume. These are objects of superseded cuts that the next cleaning pass removes (hourly by default). They are a
report only: no action is needed.
**Space.** A deleted snapshot is cleaned at the next maintenance pass (`--chunk-maintenance-interval`, default 1 h).
The disk space returns when SeaweedFS vacuums its volumes. Never run SeaweedFS `volume.fsck` with its delete flags on a
cluster holding chunk volumes.
**Delete a snapshot.** Give each delete its own request id:
```sh
sw-block ops chunk snapshot-delete --master 127.0.0.1:9180 --volume v1 --chunk-filer 127.0.0.1:18888 \
--name snapA --request-id delete-snapA-1
```
A snapshot that a restored volume depends on cannot be deleted until that volume is deleted (section 6): the delete
answers `snapshot_has_dependents` (exit 1, not retryable). Delete the dependent volume, then run the same command,
with the same request id, again.
One snapshot delete per volume at a time: a second delete answers `layout_busy` (`layout: another transaction is
open`, retryable, exit 1) until the first one's cleaning pass (up to `--chunk-maintenance-interval`, 1 h). Keep retrying it with the same request id.
## 6. Delete a volume
A deleted name is never created again. To delete the restored volume `v2`:
1. **Unmount and disconnect its guest** (section 4). The volume must be serving: if you stopped it, start it again
with the same flags first (a stopped volume answers `remote_unavailable` here, and retrying does not help). Then
seal the volume. The answer prints its `headEpoch` (E) and
`sealed HEAD generation: G`:
```sh
sw-block ops chunk detach --plain --volume v2 --status-addr 127.0.0.1:9213 --timeout 120s
```
2. **Revoke its lease and wait for the holder's acknowledgement.** Do not stop the holder yourself: it acknowledges
and exits 0 on its own. Repeat `show` until it prints `recorded ACK: r1@E HEAD generation G`, with
`lease state: revoking` (or `expired`, about 20 s later). Then disable the unit so that it does not start at boot:
```sh
sw-block ops workspace revoke --master 127.0.0.1:9180 --volume v2 --replica r1 --epoch E --sealed-gen G
sw-block ops workspace show --master 127.0.0.1:9180 --volume v2
sudo systemctl disable sw-blockvolume@v2
```
3. **Delete it** once its lease horizon has passed (about 60 s):
```sh
sw-block ops chunk volume-delete --master 127.0.0.1:9180 --volume v2 --chunk-filer 127.0.0.1:18888 \
--request-id delete-v2
```
- It answers `{"volume":"v2-<id8>","state":"deleted"}`.
- Before the horizon it answers `not_admitted ... live until <time>` and deletes nothing. Read the answer's
`retryable` field. In v1.1.1:
- **`retryable: true`, exit 75:** the delete is admitted, and its final lease barrier has not passed yet.
Run the same command, with the same request id, after that time.
- **`retryable: false`, exit 1, "stop the volume first":** blockmaster refused to admit the delete because a
serving holder still holds the lease. Do steps 1 and 2 first, then run the same command again.
- The delete removes the volume's data and snapshots. A small tombstone stays (`HEAD`, `VOLUME` and empty
directories under `/swblock/chunks/v2-<id8>/`). Do not remove it. In v1.1.x a deleted volume's id is not
reusable: create the replacement under a new name. Name reuse is planned for v1.2.
- In v1.1.0, blockmaster keeps the deleted volume's authority record. After step 4, cluster status stays
`degraded` for it (`observed_replicas_below_desired`), and `ops workspace show --volume v2` answers
`workspace: volume is being deleted`, and `cluster.check` keeps failing the deleted volume's holder checks
(`host.heartbeat`, `volume.lease`, `volume.frontend` and others). All of this is expected, and it does not
affect other volumes.
- From v1.1.1, the deleted volume reads `deleting` (reason `deletion_reserved`, `delete committed; awaiting
metadata retirement`), and the cluster stays `ok`. The deleted volume's holder checks print `deleting ... no
serving checks apply`. `cluster.check` can still exit 1 or 3 for the other volumes' cleaning check, and exits
3 when no volume is left (section 9). `ops workspace show --volume v2` still answers `workspace: volume is
being deleted`.
- After step 4, blockmaster retries metadata retirement once its restart lease floor has passed, even with the
lifecycle product loop disabled. With the default lease settings this is about 50 seconds after restart. The
volume then disappears from status and no longer blocks `cluster retire-host`, and `ops workspace show
--volume v2` answers `workspace move requires an existing RF1 volume` (exit 1): the name is no longer known.
Skipped retirement work is logged with its reason. A `reason=not_reserved` line names a volume that was not
deleted, and is normal for every running volume.
4. **Remove the volume from the cluster spec** (edit it as root, as in section 2), restart blockmaster, and remove the
settings file on the host that runs the volume now. On a host the volume moved away from (appendix B step 3), the
file is already gone. If it was the last volume, leave the `volumes:` key with no entries (`volumes: []`):
```sh
sudo rm /etc/sw-block/volumes/v2.env
```
5. **(v1.1.0 only) Remove the leftover list pages** (section 11). From v1.1.1 the delete removes them itself. On
v1.1.0 this step is needed only if a snapshot of the volume was deleted; otherwise there is nothing to remove,
and the command answers the same way (HTTP 204). The `v2-<id8>`
value is the directory from the delete's answer:
```sh
curl -X DELETE 'http://127.0.0.1:8888/swblock/chunks/v2-<id8>/lists/?recursive=true'
```
**Back out a restore target you never restored into.** In v1.1.0 you cannot remove such an entry cleanly. If you
remove it from the spec, blockmaster keeps its placement: cluster status stays `degraded` for it, and
`volume-delete` answers `volume_not_found`. Leave the entry in the spec, or restore into it.
## 7. Upgrade and finalize the v1.1 format
This section starts from a v1.0.2 cluster installed as in sections 1 and 2 with `TAG=v1.0.2`. Two differences apply
to v1.0.x:
- **No tarball.** v1.0.x releases have no tarball and no `SHA256SUMS`, so take the binaries from the release image
(or build them, appendix A), as in section 1. The image needs Docker: `sudo apt-get install -y docker.io`
(Ubuntu) or `sudo dnf install -y podman podman-docker` (RHEL). To check them, `./blockvolume --version` must print the same commit
as `git rev-parse HEAD` in the tag's clone (v1.0.2 is `2a91bfee...`).
- **No format-level checks.** Section 2's format-level checks do not exist on v1.0.x: skip the `journalctl` line and
`sw-block cluster format-level`. `sw-block ops workspace show` works.
Get the new release as in section 1, step 1, **in a new, empty directory** (the v1.0.2 clone already has the name
`seaweed-block`), and run the commands below from that fresh clone. After the upgrade, the cluster keeps
writing the v1.0 format until you finalize. Until then you can go back.
1. **The CLI first.** Install the new `sw-block`:
```sh
sudo install -m 0755 sw-block /usr/local/bin/
```
It works against the old blockmaster and holders, with two exceptions: `sw-block cluster format-level` and
`finalize-format` answer `Unimplemented` (exit 1) until blockmaster is v1.1.
2. **The units.** Install the new tag's unit files, but not its `.env` files: those hold your settings. (The v1.1
template unit adds `MemoryMax=2G`.)
```sh
sudo install -m 0644 deploy/systemd/*.service /etc/systemd/system/
sudo systemctl daemon-reload
```
3. **blockmaster.** Install the new binary, restart, and check the level:
```sh
sudo install -m 0755 blockmaster /usr/local/bin/
sudo systemctl restart sw-blockmaster
sw-block cluster format-level --master 127.0.0.1:9180 # format level 0
```
Volumes keep serving only if the restart completes before their leases expire; otherwise they fence.
Follow the [state-storage and low-write-load restart guidance](#1-install-the-binaries-and-units), including
during upgrades.
4. **Each holder.** Install the new binary once per host, then restart each volume on that host:
```sh
sudo install -m 0755 blockvolume /usr/local/bin/
sudo systemctl restart sw-blockvolume@<volume>
```
A connected guest can stay connected: the volume serves again in about a second, and guest I/O resumes about 2-3 s
after the restart (the connect's `--reconnect-delay=2`), with its data.
**Going back** before the finalize: reinstall the v1.0.x binaries in reverse order (each holder, then
blockmaster), restarting each the same way. The v1.1 CLI can stay.
5. **Finalize** once every holder runs v1.1:
```sh
sw-block cluster finalize-format --master 127.0.0.1:9180 --json
```
- **Refused** (exit 2, `FORMAT_HOSTS_TOO_OLD`) while a holder still runs v1.0.x. That holder reports format
level 0 and is named in `hosts` (for example `"reported":"volume v1 reads level 0"`). Upgrade it, or move its
volume, and run the finalize again.
- **`listed`** names the hosts the master cannot confirm but that do not block the finalize: a held volume with no
report or a stale one, a host with no report, and an old process that holds no volume.
- **Exit codes:** **0** finalized or already finalized; **2** typed precondition/argument refusal; **75** proven unsent remote failure; **3** unknown answer (read the current level before retrying); **5** authentication rejection; **78** local credential/configuration failure; **4** unproven integrity readout; **1** other definite failure or caller cancellation/deadline before send. An unknown answer does not prove the level unchanged.
- **JSON only.** The typed codes (`FORMAT_HOSTS_TOO_OLD`, and `HOST_HOLDS_WORK` below) appear only with `--json`.
Plain output says `refused`.
6. **The holders take the finalized level.** A v1.1.1 holder adopts it at its next lease renewal, with no restart:
its `/status` shows `"FormatLevel":1` and its cuts and snapshots follow. A v1.1.0 holder keeps the level it
attached at until it restarts (`sudo systemctl restart sw-blockvolume@<volume>`): its `/status` shows
`"FormatLevel":0`, its cuts fail with `format_level_below_head_version`, and snapshots answer
`no_progress ... snapshot stalled`. After the restart, the same snapshot request id settles within about a minute.
7. **Retire** a host that holds nothing and will not come back:
```sh
sw-block cluster retire-host --server <id> --confirm <id> --master 127.0.0.1:9180 --json
```
It is refused while the host holds a volume (`HOST_HOLDS_WORK`, each volume named). Right after a blockmaster
restart, it can also name a volume on that host that is already deleted. blockmaster cannot yet prove the volume's
last lease has ended, so it waits for its restart floor: the lease's 30 s grant plus the configured clock skew
(`--workspace-max-clock-skew`, 20 s by default), so about 50 s with defaults. Run the same command again after
that.
The finalize is **one-way**. Afterwards, old binaries refuse the new format:
- **A v1.0.x blockmaster** on the store restarts in a loop, with `corrupt record: envelope version 2 unsupported` and
`json: cannot unmarshal number into Go value of type master.attestedStores`.
- **A v1.0.x holder with its local store** exits 1 on every start, with `storage: invalid superblock: neither
descriptor slot is valid (... reserved byte 306 is nonzero ...)`.
- **A v1.0.x holder without a local store** gets no volume and exits 75 (`assignment_timeout`).
- **Cluster status** shows `binary_too_old` for either holder (section 9).
None of this means damage: do not rebuild anything. Install v1.1 again. A holder that restarted in a loop has hit its
unit's start limit, so clear it before you restart:
```sh
sudo systemctl reset-failed sw-blockvolume@<volume>
sudo systemctl restart sw-blockvolume@<volume>
```
## 8. Isolation: one I/O share per process
Give each volume process, blockmaster and SeaweedFS their own I/O share. Each systemd unit is already its own cgroup,
but the shipped units set no I/O limit. Setting a property enables the `io` controller. Use a write bandwidth cap on
the disk that holds each process's data. Read the disk from the mount, and never copy a device name:
```sh
VDISK=$(findmnt -no SOURCE -T /var/lib/sw-block-volume) # or your --durable-root
MDISK=$(findmnt -no SOURCE -T /var/lib/sw-block-master)
WDISK=$(findmnt -no SOURCE -T /data/weed)
sudo systemctl set-property sw-blockvolume@v1 "IOWriteBandwidthMax=$VDISK 400M"
sudo systemctl set-property sw-blockmaster "IOWriteBandwidthMax=$MDISK 100M"
sudo systemctl set-property seaweedfs "IOWriteBandwidthMax=$WDISK 400M"
systemctl show -p IOWriteBandwidthMax sw-blockvolume@v1 sw-blockmaster seaweedfs
```
- **When it applies.** The settings apply at once to running units and persist across restarts.
- **One cap per instance.** Set it for each new volume (`sw-blockvolume@v2`, ...).
- **A device that does not exist** is accepted silently and caps nothing. Check the `show` output.
- **`IOWeight=` alone** gives no isolation on a default host. With the `none` I/O scheduler (the default for NVMe and
SSDs), weights are not enforced unless BFQ or blk-iocost is configured.
Why each process needs its own share:
- **Per volume.** One cap shared by several volume processes is one queue. One volume's writeback burst can hold
another volume's sync past its 30 s startup window, and that volume then reports `recovery_stalled`. Only the WAL
fence's zero writes bypass the page cache, and only on Linux with aligned bytes, where the filesystem accepts
O_DIRECT. Every other write goes through the page cache, and even direct writes wait in their cgroup's queue.
- **blockmaster.** blockmaster writes two things durably before it answers: a volume's first lease grant and a
primary's store attestation. On a master starved of I/O, those writes outlast the holder's 2 s request, and the
volume serves nothing until they complete. At format level 1, lease renewals do not write.
- **The filer.** Cuts, snapshots and moves go through it.
## 9. Monitoring
**One check command for a start-up failure.** Run it on the volume's host, with the server id, the filer and that
volume's status address:
```sh
sw-block shell -master 127.0.0.1:9180 -filer 127.0.0.1:18888 -server-id s1 -status-addr 127.0.0.1:9203 \
-c "cluster.check"
```
Each `FAIL` names its section in [Troubleshooting](troubleshooting.md). On a healthy single host in v1.1.0 it still
exits 1, because of the known FAILs listed below. In v1.1.1, until each holder's first cleaning pass, it exits 1
or 3 (`volume.cleaning` below).
- **Missing flags.** Without `-server-id` (it defaults to the hostname) and `-status-addr`, the holder's checks print
`not checked here`. Without `-filer`, the filer check prints `not checked here`.
- **One volume per run.** `-status-addr` takes one volume's address. On a host with several volumes, run the command
once per volume and read that volume's lines: the other volumes' holder checks fail with `/status returned HTTP
404`.
- **A stopped volume** fails its holder checks (`host.heartbeat`, `volume.lease`, `volume.frontend`,
`volume.chunkstore`, `volume.cut`, `versions.equal`, and others). Some of the printed cures do not apply. Cluster
status shows the cluster `blocked` or `degraded` until the volume runs again. A volume deleted in v1.1.0 stays
`degraded` (section 6). From v1.1.1, a deleted volume reads `deleting`, its checks print `no serving checks apply`,
and the cluster stays `ok` (section 6, step 3).
- **`volume.cleaning`** after a holder start, in v1.1.0 and v1.1.1, until that holder completes its first cleaning
pass. The first pass is scheduled `--chunk-maintenance-interval` (1 h by default) after the start; that is the
nominal schedule, not a deadline, and a pass can take longer or end with an error. Until it completes the
check reads either way:
- **FAIL** `no cleaning pass completed since start` while no pass is running: `cluster.check` exits 1;
- **not checked here** `cleaning in progress since ...` while the first pass runs: with no other FAIL,
`cluster.check` exits 3.
A failed pass reads FAIL `last cleaning pass: <error>`, and that one is a fault.
- **No volume left:** every holder check prints `not checked here ... no selected volume evidence`, and
`cluster.check` exits 3. Only the per-volume checks were skipped: the master and filer checks still run, and a
real FAIL among them still makes it exit 1.
These FAILs do not mean a fault in v1.1.0:
- **`master.lifecycle`** fails with `workspace move requires an existing RF1 volume` on a correct cluster-spec setup.
Its printed cure (`blockmaster runs without --lifecycle-store`) does not apply. Check the setup with
`sw-block ops workspace show --master 127.0.0.1:9180 --volume v1` (exit 0) instead.
- **The holder checks of a deleted volume** keep failing (section 6, step 3).
**Cluster status.** `sw-block shell -master 127.0.0.1:9180 -c "cluster.status -o json"` prints every volume and node,
with its conditions.
- A volume whose holder runs an old binary has a condition with reason `binary_too_old`. It names the server and the
format level that server reported.
- A node's `last_heartbeat_at` can show blockmaster's last start rather than the latest heartbeat.
**Holder status** comes from the `--status-addr` listener, which is loopback only. Every route needs `?volume=<id>`;
without it the answer is HTTP 400 `missing volume query param`. Every field is in the
[status schema](status-schema.md).
| Route | What it shows |
|---|---|
| `curl -s '127.0.0.1:9203/status?volume=v1'` | health and `FormatLevel`; `NotReadyReason`, `MasterWait` and `RecoveryWait` only while the volume is not ready |
| `curl -s '127.0.0.1:9203/status/recovery-progress?volume=v1'` | `CounterProgressAt`, `LastProgress`, `Stalled`, `AwaitingAuthority`, `FenceBytes`, `ReplayRecords` |
| `curl -s '127.0.0.1:9203/status/durable?volume=v1'` | `CheckpointPersistence` with the reclaim progress (`ReclaimedBytes`, `FlusherPhase`, `LastExtentWrite`) and the fence counters (`FenceZeroed`, `FenceSkips`) |
| `curl -s '127.0.0.1:9203/status/peers?volume=v1'` | replication |
- **`CounterProgressAt`** is the time of the last completed WAL replay record or synced fence slice, and nothing else.
**`LastProgress`** is the last progress of any recovery phase. An unchanged `CounterProgressAt` alone does not mean
a stall.
- **`/status/recovery`** exists only on a holder started with recovery enabled. On a standalone holder it answers 404.
**Logs:** `journalctl -u sw-blockmaster` and `journalctl -u sw-blockvolume@<volume>`
([logs and verbosity](operator-guide.md#logs-and-verbosity)).
## 10. Typed errors and what to do
Volume status (`/status?volume=<id>`, heartbeats, cluster status):
| What you see | Meaning | What to do |
|---|---|---|
| `NotReadyReason: lease_not_held`, `MasterWait.Reason: unreachable` | The holder cannot reach blockmaster, so it has no lease and serves nothing. Until its lease expires (about 15-20 s after its last renewal) the old process still reports `Healthy: true`. Then it exits 75 and systemd restarts it 5 s later: the status page is gone for those seconds, the restarted process shows these fields, and the guest reconnects by itself. | Start or reach blockmaster. The volume serves again by itself. |
| `RecoveryWait: awaiting_authority` (recovery-progress `AwaitingAuthority: true`) | Recovery finished, and the volume waits for blockmaster's assignment. The startup window is paused. | As above. |
| `recovery_stalled` | No recovery step completed for a whole startup window. | Look for disk starvation (section 8). The volume serves no I/O and continues once the disk serves it. |
| `binary_too_old` | The holder's binary reads an older format than the cluster's, so it gets no assignment. | Upgrade that host to v1.1 (section 7). |
| `wal_corrupt` | The local WAL failed an integrity check. | Do not delete the store. Collect logs and status, and report it. |
| `io_error` | A local I/O error latched the store. | Check the disk. Restart the volume once the disk is healthy. |
| `store_format_newer`, `head_newer_version` (exit 78) | A later version wrote the store or HEAD. | Run the later version. The unit does not restart after a final exit. |
`sw-block` commands. The JSON answer carries a typed `code` or `reason`. ordinary definite `ops chunk` refusals exit 1; server argument refusals exit 2, authentication rejections 5, and local credential/configuration failures 78. A possibly admitted unknown answer exits 3, except incomplete verify uses 1 so it cannot be mistaken for completed findings.
| Code or reason | Seen from | Meaning | What to do |
|---|---|---|---|
| `FORMAT_HOSTS_TOO_OLD` (exit 2, `--json`) | finalize | A holder of a volume reports an older format. | Upgrade or move each host in `hosts`. |
| `HOST_HOLDS_WORK` (exit 2, `--json`) | retire-host | The host still holds the volumes named. | Move or delete them first. |
| `BINARY_TOO_OLD` | move preview | The move target runs an older binary. | Upgrade the target, or choose another. |
| `SIZE_REQUIRES_FORMAT_LEVEL_1` (exit 78) | `ops volume create` | A volume above 256 GiB before the finalize. | Finalize (section 7), or use a smaller volume. (From the cluster spec, this is a blockmaster log line, section 3.) |
| `deadline_exceeded` (retryable) | verify and others | The window or deadline passed: a verify pass stopped without progress. | Retry. If it repeats, look for a slow filer or a starved disk. |
| `remote_unavailable` (retryable) | holder calls; from v1.1.1 every `ops chunk` command that contacts a filer or master | Proven unsent failure, or a definite server answer that permits retry: exit 75. A possibly admitted failure is `outcome_unknown`, exit 3 (incomplete verify: 1); a non-retryable typed `remote_unavailable` exits 1. | Restore connectivity. For an unknown answer, replay the original request id or poll/read the original operation; never start another non-idempotent operation. |
| `internal` | `ops chunk` commands with `--chunk-filer` | v1.1.0 only: also what an unreachable filer gives, and `ops chunk verify` and `ops chunk snapshot-delete` instead answer `bad_request: ... needs exactly one filer ... connection refused` (exit 2) after 30-60 s. From v1.1.1 these are `remote_unavailable`. | Check the filer address and that the filer runs, then retry. |
| `not_admitted` | restore | The target is not in the cluster spec. The printed cure (`--lifecycle-product-loop-interval`) does not apply to this setup. | Add the target without `size_bytes` and restart blockmaster (section 5). |
| `not_admitted ... live until <time>` | volume-delete | The volume's lease horizon has not passed. In v1.1.1 the answer's `retryable` field says which case applies: `true` (exit 75) means the delete is admitted and waits for its final lease barrier; `false` (exit 1, "stop the volume first") means a serving holder still holds the lease, so the delete was not admitted. | `true`: repeat with the same request id after that time. `false`: stop the holder (section 6, steps 1 and 2), then repeat (section 6). |
| `remote_full` | cuts, snapshots | The chunk store has no space. | Add capacity, then retry. |
| `queue_full` | cuts, snapshots | Reclamation work must drain before another producer publishes. | Retry later. |
| `format_level_below_head_version` | cuts, in the holder log | The holder still runs at the format level it attached at, from before the finalize. | A v1.1.1 holder adopts the finalized level at its next lease renewal; restart a v1.1.0 holder (section 7). |
| `no_progress` (retryable) | snapshot, snapshot-delete | The operation has not settled: a snapshot stalled (for example right after a finalize, section 7), or a snapshot delete's work did not finish in this call. Retrying a snapshot with the same request id settles it, which can take several minutes. | For snapshot, keep retrying with the same id. For snapshot-delete, do not resume it by hand: a resume can stop the volume's snapshot deletes and cleaning (see the snapshot delete known issue in the [v1.1.1 notes](releases/v1.1.1.md)). |
| `snapshot_has_dependents` (exit 1) | snapshot-delete | A restored volume depends on the snapshot. Not retryable: retrying does not help until that volume is deleted. | Delete the dependent volume first (section 6), then run the same command with the same request id; or keep the snapshot. |
| `layout_busy` (retryable, exit 1) | snapshot-delete | `layout: another transaction is open`: an earlier snapshot delete on the same volume waits for its cleaning pass, which can take up to `--chunk-maintenance-interval` (1 h). | Keep retrying with the same id; it settles after that pass. If it does not settle after a cleaning pass, see the snapshot delete known issue in the [v1.1.1 notes](releases/v1.1.1.md). |
| `outcome_unknown` | various | The request may or may not have taken effect. | See below. |
| `snapshot_exists`, `snapshot_limit` | snapshot | The name is taken, or there are too many snapshots. | Use another name, or delete old snapshots. |
| `snapshot_not_found` | restore | No snapshot has that name. (To see it, you need a target in the spec; there is no need to provoke it.) | Check `ops chunk snapshots`. |
| `not_found` (v1.1.0), `snapshot_not_found` (v1.1.1) | snapshot-delete | No snapshot has that name. | Nothing to delete. |
| `snapshot_deleting` | snapshot, restore | The snapshot is being deleted. | Wait for the delete. |
| `target_exists` | restore | The target already exists: an entry with `size_bytes`, or another restore request's target. | Use a new target name (a deleted name is never created again). |
| `volume_not_found` | volume-delete | No volume has that name. | Check the name. (A spec entry backed out before a restore, section 6.) |
| `geometry_mismatch`, `not_chunk_volume`, `invalid_name` | restore, snapshot | The target or the name does not fit. | Correct the command. |
| guests refusal (exit 2) | `volume stop` | A guest is still connected. | Unmount, disconnect (NVMe or iSCSI), and stop again (section 4). |
| `exists with other settings` and `pass --replace` (exit 1) | `volume start` | The volume's settings file has other flags. | Use the same flags. To change them, stop the volume first (section 4), then start it with `--replace`. |
**After an unknown outcome.**
- **Commands with `--request-id`** (`ops chunk snapshot`, `snapshot-delete`, `restore`, `volume-delete`,
`ops workspace move` with or without `--clean`, and `ops workspace force-move`): repeat the command with the same
request id until it answers. The answer settles what happened. This can take several minutes. Do not repeat an
interrupted `snapshot-delete` by hand: a resume can stop the volume's snapshot deletes and cleaning (see the snapshot
delete known issue in the [v1.1.1 notes](releases/v1.1.1.md)).
- **`ops chunk cut`** has no request id. Repeat the cut: a later cut gives a later durable point. It does not tell you
whether the earlier cut committed; for that, check the volume's snapshots and its last cut in status.
- **`volume stop`**: run the same `sudo /usr/local/bin/sw-block volume stop <volume>` again. Before its cut succeeds
the unit keeps running. A stop that printed `not released` or `release not confirmed` has stopped the unit; running it again reads
blockmaster's lease record and gives the final answer (released, moved, or the lease ended without a release).
Exit codes differ per command, and each command's `--help` states them. Most commands use:
- **0** done;
- **1** failed;
- **2** usage or refused;
- **75** transient (retry);
- **78** final (do not retry).
## 11. Known limitations
As released in v1.1.0 ([release notes](https://github.com/seaweedfs/seaweed-block/releases/tag/v1.1.0)); the items
marked "v1.1.0 only" are lifted in v1.1.1 ([v1.1.1 notes](releases/v1.1.1.md)):
- **Long manual cuts (v1.1.0 only).** A manual cut whose upload runs longer than about five minutes ends
`cut_aborted`. The chunks it uploaded are kept: repeat the cut, which reuses them, or give it a longer `--timeout`.
In v1.1.1 a cut runs while it makes progress, and ends `cut_stalled` only after its no-progress window.
- **Stopping right after a fill.** Stopping a large volume soon after it was filled can answer that the cut's outcome
is unknown, with the unit left running. Run the same `sudo /usr/local/bin/sw-block volume stop` again.
- **Cleaning near 1 TiB (v1.1.0 only).** On volumes near 1 TiB, a cleaning pass may not finish. In v1.1.1 a pass runs
while it advances and ends `no_progress` only after a minute without progress.
- **List pages after a volume delete (v1.1.0 only).** The snapshot-delete list pages under the deleted volume's
directory (`lists/`) may remain: up to about 21 MB per deleted snapshot of a fully written 1 TiB volume. Nothing
reads them, so they are data-safe, and `verify --orphans` does not list them. Remove them as in section 6, step 5.
In v1.1.1 the delete removes them, and the layout verifier reports pages left by earlier deletes.
- **CLI first.** The manual cut API changes in v1.1.1. Use the newest `sw-block` CLI, and upgrade it first
(section 1).
- **After the finalize (v1.1.0 holders only)**, restart each holder; a v1.1.1 holder adopts the finalized level at its
next lease renewal (section 7).
- **Backing out an unused restore target** leaves its placement behind (section 6).
- **`cluster.check` FAILs** that are not faults (section 9).
In every v1.1.x:
- **Volume size** is at most 1 TiB, and start time grows with size (section 3).
- **The first restart right after a large fill** can take seconds longer than later restarts, while the kernel writes
back the fill.
- **One filer per chunk store.** It is a single point of availability for cuts, snapshots and moves.
- **No guest freeze.** Snapshots are crash-consistent only.
- **Shared I/O caps** can starve a volume or blockmaster (section 8).
- **The finalize is one-way** (section 7).
- **Unauthenticated chunk control endpoint.** Keep `--chunk-control-endpoint` on loopback.
- **Cleaning is on by default.** Space returns only after the next maintenance pass and a SeaweedFS vacuum.
## 12. Remove everything
**Only for the dedicated single-host installation this manual built**: its own `seaweedfs` unit with data in
`/data/weed`, and blockmaster and every volume on this one host. It deletes every volume's data, blockmaster's state
and that SeaweedFS data, and nothing can be recovered. Do not use it as written on several hosts: for appendix B's
two hosts, follow the host-by-host order there. Where SeaweedFS was already running before this manual, skip step
3's SeaweedFS lines; that SeaweedFS and its data stay.
1. **Stop every volume** (each guest unmounted and disconnected first, section 4). Each stop must end with
`recovery point in the object store: ...` or `nothing to cut or stop` (exit 0). If a stop refuses, fix the cause it
names and run it again; do not go on. `disable` alone does not stop a running holder. Skip volumes you deleted
in section 6: their stop answers `settings: ... no such file or directory` (exit 2), and that is expected.
```sh
sudo /usr/local/bin/sw-block volume stop v1
```
For iSCSI guests, also remove the node record that discovery saved for each target this manual logged in to,
including volumes deleted in section 6 (their logout in section 6 kept the record, and it logs in again at boot).
Name each target and its portal, so no other target's record is touched:
```sh
sudo iscsiadm -m node -T iqn.2026-12.io.seaweedfs:v1 -p 127.0.0.1:3260 -o delete
sudo iscsiadm -m node -T iqn.2026-12.io.seaweedfs:v2 -p 127.0.0.1:3261 -o delete
```
2. **Stop blockmaster, and check that nothing of it runs.** The check must exit 0 and print `nothing runs`. If
`systemctl` itself fails, or any unit is listed, do not go on:
```sh
sudo systemctl disable --now sw-blockmaster
units=$(systemctl list-units 'sw-blockvolume*' 'sw-blockmaster*' --state=active,activating,deactivating --no-legend) &&
{ test -z "$units" && echo "nothing runs" || echo "still running: $units"; }
```
3. **Remove sw-block.** The removal runs only after the same check succeeds in the same command. A failed query
removes nothing:
```sh
units=$(systemctl list-units 'sw-blockvolume*' 'sw-blockmaster*' --state=active,activating,deactivating --no-legend) &&
test -z "$units" &&
sudo rm -rf /var/lib/sw-block-volume /var/lib/sw-block-master /etc/sw-block &&
sudo rm -f /etc/systemd/system/sw-blockmaster.service /etc/systemd/system/sw-blockvolume.service \
/etc/systemd/system/sw-blockvolume@.service /etc/systemd/system/sw-blockvolume-ublk.service \
/etc/tmpfiles.d/sw-block.conf /usr/local/bin/blockmaster /usr/local/bin/blockvolume /usr/local/bin/sw-block &&
sudo rm -rf /etc/systemd/system/sw-blockvolume@*.service.d /run/sw-block &&
sudo systemctl daemon-reload && sudo userdel sw-block
sudo rmdir /mnt/v1 /mnt/v2 2>/dev/null || true # the guest mount points (section 5's restore target too), if empty
```
With SELinux, remove the iSCSI port label that sections 3 and 5 added, and only that one: 3261 here, and any
other port you labeled for this installation. Do not remove 3260 (the policy's own label) or a label that existed
before this manual (`sudo semanage port -l | grep iscsi_port_t` shows them):
```sh
sudo semanage port -d -t iscsi_port_t -p tcp 3261
```
The SeaweedFS that section 0 created for this installation, and only that one:
```sh
sudo systemctl disable --now seaweedfs &&
state=$(systemctl show -p ActiveState --value seaweedfs) && test "$state" = inactive &&
sudo rm -rf /data/weed && sudo rm -f /etc/systemd/system/seaweedfs.service /usr/local/bin/weed &&
sudo systemctl daemon-reload
sudo rmdir /data 2>/dev/null || true # if section 0 created it and it is now empty
```
## Appendix A. Build from source
Build in the clone from section 1, step 1. Use the Go version that `go.mod` names (`go 1.25` for v1.1.x): take the
newest 1.25.x Linux archive from https://go.dev/dl/ and check its sha256 against the one that page lists.
```sh
grep '^go ' go.mod # go 1.25
GOVER=1.25.X # the newest 1.25 patch listed on https://go.dev/dl/
curl -fsSLO https://go.dev/dl/go$GOVER.linux-amd64.tar.gz
sha256sum go$GOVER.linux-amd64.tar.gz # must equal the sha256 shown on https://go.dev/dl/
mkdir -p "$HOME/go$GOVER" && tar -C "$HOME/go$GOVER" -xzf go$GOVER.linux-amd64.tar.gz # leaves any other Go alone
export PATH="$HOME/go$GOVER/go/bin:$PATH" # this Go first
go version # must print go$GOVER
for b in blockmaster blockvolume sw-block; do go build -o $b ./cmd/$b; done
./blockvolume --version # revision=<the tag's commit>
```
Then install them as in section 1, step 2.
## Appendix B. Two hosts and a planned move
This is the two-host variant of sections 0–5. A runs blockmaster, SeaweedFS and the initial holder (`s1`); B is
the move target (`s2`). Both use the same release and chunk store. The guest runs on A while A holds the volume,
then on B after the move. This procedure moves the block volume; it does not migrate a running guest application
or VM. Stop the application before unmounting and start it on B after checking its files.
### Addresses and certificates, before starting services
Install section 0's guest packages and section 1's binaries, user and units on **both** hosts. Install SeaweedFS
and run blockmaster only on A. Choose the private addresses before issuing certificates:
| Marker or address | Where it comes from and where to use it |
|---|---|
| `<A-IP>:9180` | A's private interface; blockmaster listen address and every CLI/holder's `--master` |
| `<A-IP>:18888` | SeaweedFS filer gRPC on A; every `--chunk-filer` |
| `<A-IP>:9201`, `<A-IP>:9202` | s1's data/control addresses, in the spec and A's holder settings |
| `<B-IP>:9201`, `<B-IP>:9202` | s2's data/control addresses, in the spec, move command and B's holder settings |
| `127.0.0.1:9203` | Holder status/chunk control, read on A before the move and on B afterwards |
| `127.0.0.1:4420` | Guest NVMe/TCP on the current holder's host; never replace it with a node address |
Use unused ports if these are occupied, changing every matching setting. Allow the control and SeaweedFS traffic
between the private hosts. SeaweedFS also advertises its master and volume-server addresses: both hosts must reach
those advertised addresses, not just the filer. In section 0's SeaweedFS unit, replace `-ip=127.0.0.1` with
`-ip=<A-IP>` before starting it. The example uses master 9333, filer HTTP 8888, filer gRPC 18888 and volume HTTP 8080;
confirm the actual listeners with `ss -ltn`. SeaweedFS traffic is not protected by blockmaster's mTLS: keep it on
the trusted private network.
Issue the certificates: a CA, a master certificate whose SAN includes `<A-IP>`, node certificates with CN `s1` and
`s2`, and a separate operator certificate on each host (CN `ops-a` and `ops-b`). Generate each private key on its
owning host and send only its CSR to the CA. Keep the CA signing key off the service hosts.
```sh
# on the CA machine, once
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
# on the owning host, one key and CSR per certificate:
# A: master (CN blockmaster), node (CN s1), operator (CN ops-a); B: node (CN s2), operator (CN ops-b)
openssl req -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes -subj "/CN=s1" -keyout node.key -out node.csr
# on the CA machine, sign each CSR (the master's with its address in the SAN)
openssl x509 -req -in node.csr -CA ca.crt -CAkey ca.key -CAcreateserial -days 825 -out node.crt
openssl x509 -req -in master.csr -CA ca.crt -CAkey ca.key -CAcreateserial -days 825 \
-extfile <(printf "subjectAltName=IP:<A-IP>") -out master.crt
```
A's role file (`/etc/sw-block/tls/roles`) has one line per client certificate, `sha256:<fingerprint> <role> <id>`,
where the id equals the certificate's CN: `node s1`, `node s2`, `admin ops-a` and `admin ops-b`. For each signed
client certificate, for example s1's signed `node.crt`:
```sh
echo "sha256:$(openssl x509 -in node.crt -outform DER | sha256sum | cut -d' ' -f1) node s1" >> roles
```
Background: [authenticate the control API](operator-guide.md#authenticate-the-control-api).
Install the CA certificate, that host's node certificate/key and operator certificate/key under
`/etc/sw-block/tls/` as `ca.crt`, `node.crt`, `node.key`, `operator.crt`, `operator.key`. A additionally needs
`master.crt`, `master.key` and `roles`. Use root-owned files, group `sw-block`, mode 0640 for service keys and
mode 0750 for the directory. Keep the operator key readable only by its operator (root in the examples below).
The commands below run in a root shell (`sudo -i` first). Run every `sw-block` command there **without** `sudo`,
including the ones sections 4, 6 and 12 print with `sudo /usr/local/bin/sw-block ...`: `sudo` resets the
environment even from root, so the command loses the `SW_BLOCK_TLS_*` credentials and cannot reach blockmaster
(`release not confirmed ... error reading server preface: EOF`). On each host, export the operator credentials before
CLI calls:
```sh
export SW_BLOCK_TLS_CERT=/etc/sw-block/tls/operator.crt
export SW_BLOCK_TLS_KEY=/etc/sw-block/tls/operator.key
export SW_BLOCK_TLS_CA=/etc/sw-block/tls/ca.crt
```
An ordinary user's exported variables are not automatically passed through `sudo`.
On A, section 2's spec must list **both** nodes, with data/control addresses from the table above. Keep v1's
4 GiB geometry and initial placement `s1/r1`. In `/etc/sw-block/blockmaster.env`, keep section 2's topology,
expected-slots and workspace settings, and replace the following two lines (literal addresses, no markers):
```sh
SWB_MASTER_LISTEN=<A-IP>:9180
SWB_MASTER_EXTRA_ARGS=--cluster-spec /etc/sw-block/cluster-spec.yaml --lifecycle-store /var/lib/sw-block-master/lifecycle --chunk-filer <A-IP>:18888 --chunk-path /swblock/chunks --tls-cert /etc/sw-block/tls/master.crt --tls-key /etc/sw-block/tls/master.key --tls-client-ca /etc/sw-block/tls/ca.crt --role-file /etc/sw-block/tls/roles --audit-log /var/lib/sw-block-master/audit.log
```
Then start blockmaster as in section 2. Check `cluster format-level` and `ops workspace show` with
`--master <A-IP>:9180`. A non-loopback listen without the complete mTLS configuration is refused.
### Start the holder and guest on A
`volume start` writes the instance settings but has no flags for the holder's mTLS credentials. Before its first
start, on **both** hosts add those flags to a per-instance systemd override. The root shell from `sudo -i`
starts in root's home, so this block reads the installed template by its absolute path. It copies the shipped
`ExecStart` unchanged except for appending the three TLS flags. The settings file's `--layout-id` and other extra
arguments remain in use:
```sh
mkdir -p /etc/systemd/system/sw-blockvolume@v1.service.d
test "$(grep -c '^ \$SWB_VOLUME_EXTRA_ARGS$' /etc/systemd/system/sw-blockvolume@.service)" = 1 &&
{ printf '[Service]\nExecStart=\n';
sed -n '/^ExecStart=/,/^ \$SWB_VOLUME_EXTRA_ARGS$/p' /etc/systemd/system/sw-blockvolume@.service |
sed 's|^ \$SWB_VOLUME_EXTRA_ARGS$| $SWB_VOLUME_EXTRA_ARGS --master-tls-cert /etc/sw-block/tls/node.crt --master-tls-key /etc/sw-block/tls/node.key --master-ca /etc/sw-block/tls/ca.crt|';
} > /etc/systemd/system/sw-blockvolume@v1.service.d/master-tls.conf
systemctl daemon-reload
```
The `test` must succeed; if it does not, inspect the shipped unit instead of starting with an empty override.
Keep this override aligned with the shipped `ExecStart` when upgrading the unit.
On **A**, start v1 using section 3, with these explicit network addresses:
```sh
/usr/local/bin/sw-block volume start v1 --master <A-IP>:9180 --server-id s1 --replica-id r1 \
--data-addr <A-IP>:9201 --ctrl-addr <A-IP>:9202 --status-addr 127.0.0.1:9203 \
--size 4GiB --nvme-listen 127.0.0.1:4420 --chunk-filer <A-IP>:18888
```
Wait for Healthy, then attach the guest on **A** using section 3's loopback `nvme connect`, discover the device,
make its filesystem once and mount it. Write your test files; save their `sha256sum` output outside the volume
and copy that manifest to B. Take a snapshot as in section 5 on A. Commands needing the master/filer use
`--master <A-IP>:9180 --chunk-filer <A-IP>:18888`; commands using `--status-addr` run on the current holder's host.
### Planned move A → B, with the guest following
Prepare B's certificates, override, binary and guest packages **before** moving. B must have no stale local copy
of v1; do not copy A's WAL or settings file to B. Do not use `volume stop` between sealing and the revocation ACK.
1. **On A**, check the files against the saved manifest, stop their writer, unmount `/mnt/v1` and disconnect the
guest with `nvme disconnect -n nqn.2026-05.io.seaweedfs:v1`. Leave the holder running.
2. **On A**, read the current replica `R` and epoch `E`, then seal. Copy the returned sealed HEAD generation `G`:
```sh
sw-block ops workspace show --master <A-IP>:9180 --volume v1
sw-block ops chunk detach --plain --volume v1 --status-addr 127.0.0.1:9203 --timeout 120s
```
Continue only after detach exits 0. `R`, `E` and `G` below are the values you just read, not literal arguments.
3. **On A**, revoke and repeat show until its recorded ACK matches **all three** values:
```sh
sw-block ops workspace revoke --master <A-IP>:9180 --volume v1 --replica R --epoch E --sealed-gen G
sw-block ops workspace show --master <A-IP>:9180 --volume v1
```
Require `recorded ACK: R@E HEAD generation G`. The holder exits 0 by itself; a signal stop skips the ACK.
Check `systemctl is-active sw-blockvolume@v1` reports inactive, then `systemctl disable sw-blockvolume@v1`
on A so it does not start there at boot. A's settings file and local store are no longer used; remove them so
they cannot start an old copy later:
```sh
rm /etc/sw-block/volumes/v1.env && rm -rf /var/lib/sw-block-volume/v1
```
4. **On A**, move authority, keeping one request id for all retries:
```sh
sw-block ops workspace move --clean --master <A-IP>:9180 --volume v1 --replica R --epoch E \
--target-host s2 --target-data <B-IP>:9201 --target-ctrl <B-IP>:9202 --request-id move-v1-1
```
An unknown outcome is settled by the same command and request id. Do not start B until the move is issued.
5. **On B**, start the holder immediately (within the new epoch's 30-second lease):
```sh
/usr/local/bin/sw-block volume start v1 --master <A-IP>:9180 --server-id s2 --replica-id r1 \
--data-addr <B-IP>:9201 --ctrl-addr <B-IP>:9202 --status-addr 127.0.0.1:9203 \
--size 4GiB --nvme-listen 127.0.0.1:4420 --chunk-filer <A-IP>:18888
```
If that lease has already expired, the holder waits for the re-grant barrier. For this new format-level-1
cluster, the barrier is the master's grant deadline plus configured clock skew: with defaults and no renewal
or master restart, 30 + 20 = 50 seconds after the move. A later renewal or master restart changes the relevant
deadline or restart floor. Follow the holder's typed re-grant retry/barrier answer; keep the same move request
id and target holder instead of issuing another move. The older format-level-0 horizon calculation in the
lifecycle page is not the rule for this level-1 cluster.
6. **On B**, require Healthy and check `ops workspace show --master <A-IP>:9180 --volume v1`: holder `r1` at
the new epoch and the issued `move-v1-1`. Connect NVMe using section 3's **loopback** command, discover B's
device and mount the existing filesystem at `/mnt/v1`. **Do not run mkfs again.** Check the copied SHA-256
manifest against the mounted files before restarting their writer. A no longer has a connected guest.
For iSCSI, use section 4's logout on A and section 3's loopback discovery/login on B instead of NVMe disconnect
and connect. The same seal, ACK and move sequence applies. Stop, snapshots and holder-status commands now run on B;
the master and filer remain on A. Keep the same volume size, replica id and chunk path throughout.
**Teardown on two hosts**, in the root shell, with its `sw-block` commands run without `sudo` (as above):
1. **On B, while blockmaster on A still runs:** unmount and disconnect the guest. Then run section 12 step 1
(`sw-block volume stop v1`), which releases the lease through blockmaster on A, and steps 2 and 3, without the
SeaweedFS block.
2. **On A:** skip section 12 step 1 for `v1`. The move made it B's: A's instance was revoked, its unit is inactive
and disabled, and its settings file is gone, so `volume stop v1` would answer `settings: ... no such file or
directory` (exit 2). Check that no holder runs on A (section 12 step 2's check must print `nothing runs`). Then run
section 12 step 2, and step 3 with the SeaweedFS block.
Section 12's removal also removes the per-instance TLS override (`/etc/systemd/system/sw-blockvolume@*.service.d`).
Remove `/etc/sw-block/tls` with `/etc/sw-block`, and keep the CA key where it is.