SeaweedFS volume migration
Namespace: seaweedfs · Storage class change: local-path-retain → local-path-retain-expand · Nodes: mac-mini, nuc-a, nuc-b · Date: 2026-08-19
Runbook and incident log for migrating the production SeaweedFS volume-server PVCs onto an expandable storage class, without losing any data — and everything that broke along the way.
1. Why migrate¶
The three production volume-server PVCs were provisioned on local-path-retain, a Rancher local-path storage class with ALLOWVOLUMEEXPANSION: false. Every volume was fixed at 50Gi with no way to grow it. A second class, local-path-retain-expand, already existed on the cluster with expansion enabled — the goal was to get the running volume servers onto it without touching the data they hold.
| Storage class | Reclaim | Binding | Expandable |
|---|---|---|---|
local-path-retain |
Retain | WaitForFirstConsumer | No |
local-path-retain-expand |
Retain | WaitForFirstConsumer | Yes |
longhorn-retain (default) |
Retain | Immediate | Yes |
A PVC's storageClassName is immutable once set, and it can't be changed retroactively by editing the StatefulSet — running claims stay exactly as they were provisioned. Reaching the new class meant retiring each volume server's storage one at a time and letting SeaweedFS heal itself back to full redundancy in between.
2. Cluster & replication¶
Three volume-server pods, one per labelled node, each holding a slice of the volume space:
| Pod | Node | Role |
|---|---|---|
seaweedfs-volume-0 |
mac-mini | volume server |
seaweedfs-volume-1 |
nuc-a | volume server |
seaweedfs-volume-2 |
nuc-b | volume server |
The master is configured with -defaultReplication=001 (03-master-statefulset.yaml) — every volume keeps 2 live copies on two different volume servers. That single spare copy is what made a rolling, one-at-a-time migration safe: as long as the two servers left standing between them cover every volume ID, the third can be wiped and rebuilt with zero data loss.
Rule: never take a second volume server offline until
volume.listconfirms the remaining two together cover all 12 volume IDs. This was checked before every cycle below.
3. The plan¶
Repeat once per replica, in any order, one at a time:
- Confirm the remaining two nodes cover every volume ID.
- Delete the PVC, then the pod — in that order.
- Confirm the fresh PVC is on the new storage class.
- In
weed shell, heal replication back to 2 copies and rebalance onto the new empty node. - Re-verify full coverage before touching the next replica.
Before any of that, the StatefulSet's volumeClaimTemplates itself had to point at the new class — and that turned out to need its own workaround, covered first in the log below.
4. Migration log¶
Pointing the template at the new class¶
Changed storageClassName in 05-volume-statefulset.yaml from local-path-retain to local-path-retain-expand.
Blocked — kubectl apply was rejected outright:
The StatefulSet "seaweedfs-volume" is invalid: spec: Forbidden: updates
to statefulset spec for fields other than 'replicas', 'ordinals',
'template', 'updateStrategy', 'revisionHistoryLimit',
'persistentVolumeClaimRetentionPolicy' and 'minReadySeconds' are forbidden
volumeClaimTemplates is entirely immutable on a live StatefulSet — not just resizing, any change to it is refused.
Fix — delete and recreate the StatefulSet object itself with --cascade=orphan, which leaves the running pods and their PVCs completely untouched:
kubectl delete statefulset seaweedfs-volume -n seaweedfs --cascade=orphan
kubectl apply -f services/infrastructure/seaweedfs/prod/05-volume-statefulset.yaml
Pod ages were unchanged afterward — confirming nothing restarted. The template now provisions any future PVC on the new class.
Cycle 1 — seaweedfs-volume-2 (nuc-b)¶
First attempt — race condition. Deleted the pod, then the PVC. The StatefulSet recreated the pod almost instantly — fast enough that it rebound to the old, still-existing PVC before the delete command even ran. The PVC then sat in Terminating forever, blocked by its pvc-protection finalizer, because a pod was actively using it again.
Recovery — scaled the StatefulSet down by one (removes the highest-ordinal pod, conveniently the one being migrated), deleted the now-unreferenced PVC, then scaled back up:
kubectl scale statefulset seaweedfs-volume -n seaweedfs --replicas=2
# wait for the pod to fully disappear
kubectl delete pvc volume-data-seaweedfs-volume-2 -n seaweedfs
kubectl scale statefulset seaweedfs-volume -n seaweedfs --replicas=3
This produced a clean, empty PVC on local-path-retain-expand.
Re-healing replication. weed shell requires a lock before any mutating command:
This restored 2 copies for every under-replicated volume — but landed them all on the two existing nodes, leaving the freshly emptied node with nothing. fix.replication only repairs replica count; it has no notion of rebalancing onto a specific node. volume.balance -collection ALL_COLLECTIONS -apply was tried next and moved nothing, for reasons not fully diagnosed.
Fix — moved the six affected volumes explicitly, splitting the source between both existing nodes so neither was fully drained:
volume.move -source <VOLUME_1_OLD_POD_IP>:8080 -target <VOLUME_2_NEW_POD_IP>:8080 -volumeId 2
volume.move -source <VOLUME_1_OLD_POD_IP>:8080 -target <VOLUME_2_NEW_POD_IP>:8080 -volumeId 6
volume.move -source <VOLUME_1_OLD_POD_IP>:8080 -target <VOLUME_2_NEW_POD_IP>:8080 -volumeId 16
volume.move -source <VOLUME_0_POD_IP>:8080 -target <VOLUME_2_NEW_POD_IP>:8080 -volumeId 4
volume.move -source <VOLUME_0_POD_IP>:8080 -target <VOLUME_2_NEW_POD_IP>:8080 -volumeId 13
volume.move -source <VOLUME_0_POD_IP>:8080 -target <VOLUME_2_NEW_POD_IP>:8080 -volumeId 17
Result: 12 volumes, each with exactly 2 copies, spread 9 / 6 / 9 across the three nodes.
Cycle 2 — seaweedfs-volume-1 (nuc-a)¶
Reversed the delete order — clean. The scale trick only ever removes the highest-numbered pod, so it couldn't be reused for a middle replica. Instead, the order of the original two commands was reversed — PVC first, pod second:
kubectl delete pvc volume-data-seaweedfs-volume-1 -n seaweedfs
kubectl delete pod seaweedfs-volume-1 -n seaweedfs
Deleting the PVC while the pod still uses it just marks it Terminating harmlessly. Deleting the pod immediately after removes the last reference, so the finalizer clears and the PVC is actually gone before the StatefulSet tries to recreate the pod. No stuck state this time — the new pod came up on the new class within 22 seconds.
Re-healing, again partially. volume.fix.replication -apply landed 6 of the 9 needed volumes on the new node and dumped the remaining 3 (4, 13, 17) onto the node with more free capacity. Moved them explicitly:
volume.move -source <VOLUME_0_POD_IP>:8080 -target <VOLUME_1_NEW_POD_IP>:8080 -volumeId 4
volume.move -source <VOLUME_0_POD_IP>:8080 -target <VOLUME_1_NEW_POD_IP>:8080 -volumeId 13
volume.move -source <VOLUME_0_POD_IP>:8080 -target <VOLUME_1_NEW_POD_IP>:8080 -volumeId 17
Back to a clean 9 / 6 / 9 split, full redundancy confirmed.
Cycle 3 — seaweedfs-volume-0 (mac-mini)¶
Same order, no manual moves needed — clean. Delete-PVC-then-pod again, then volume.fix.replication -apply. This time it placed the full, correct set of 9 volumes back exactly where the old node had held them — no volume.move required. Confirms the imbalance seen in the earlier two cycles is inherent to fix.replication's placement choice, not a rule — sometimes it gets it right.
5. Gotchas learned¶
volumeClaimTemplatesis fully immutable on a live StatefulSet. To change it, delete the StatefulSet with--cascade=orphanand reapply — pods and PVCs are untouched.- Delete order matters. Pod-then-PVC risks the new pod rebinding to the old PVC before it's deleted, wedging it in
Terminating. PVC-then-pod avoided this every time it was tried. - If a PVC does get stuck in
Terminating, deleting the pod once more clears the last reference and lets the finalizer finish. kubectl scale --replicas=Nonly ever removes or adds the highest-ordinal pod. It's a viable recovery trick for the last replica only, not for one in the middle.weed shellneedslockbefore any mutating command will run.volume.fix.replicationrestores replica count, not placement — it may not put copies on the node you just emptied.volume.balance -collection ALL_COLLECTIONS -applymoved nothing in this cluster, cause unconfirmed. Don't rely on it without checkingvolume.listafterward.volume.move -source ... -target ... -volumeId ...is the reliable, deterministic tool for placing a specific volume replica exactly where you want it.
6. Final state¶
| PVC | Storage class | Capacity | Pod |
|---|---|---|---|
volume-data-seaweedfs-volume-0 |
local-path-retain-expand |
50Gi | Running |
volume-data-seaweedfs-volume-1 |
local-path-retain-expand |
50Gi | Running |
volume-data-seaweedfs-volume-2 |
local-path-retain-expand |
50Gi | Running |
All 12 volume IDs verified at exactly 2 live copies apiece, spread across all three nodes. No data loss at any point. Future growth is now a plain PVC edit — no repeat of this whole procedure needed, since the class allows expansion directly.
Not done: the master StatefulSet's three 1Gi PVCs are still on
local-path-retain. Lower priority — it's only Raft metadata — but the same procedure applies if it's ever needed.
7. Appendix: S3 pod restarts¶
Noticed separately while checking the fleet post-migration: seaweedfs-s3 had restarted 18 times. Unrelated to the volume work above — investigated in the same session.
| Signal | Reading |
|---|---|
| Last exit | Completed, exit code 0 |
| Run time before exit | ~70 seconds |
| Stable since | 42 hours (no crash since) |
seaweedfs-filer-0 age |
42 hours — same window |
A clean exit code with no OOM or error rules out a crash — something was telling the container to stop, repeatedly, for about an hour, then it settled. The filer pod's age lines up almost exactly with the last restart, and the filer runs as a single replica with no failover. seaweedfs-s3 is also hardcoded to one specific filer pod's DNS name rather than the filer service (09-s3-deployment.yaml) — though with only one filer replica behind that service too, that distinction wouldn't have changed anything here.
Best working theory: the filer restarted for an unrelated reason, and s3 bounced repeatedly while it waited for the filer to come back, before finally catching up. Kubernetes' default ~1 hour event retention meant the original trigger was already gone by the time this was investigated.
Open, not fixed. Real resilience would mean running multiple filer replicas behind a shared metadata store (etcd, MySQL, or Postgres) instead of one filer with local state — a real architecture change, not attempted here since the pod has been stable. If it flaps again, capture
kubectl describe podandkubectl get events -n seaweedfsimmediately, before they age out.
Written up from a live migration session against the playtelly-iac repository, services/infrastructure/seaweedfs/prod/.