docs(block): keep the sw-block removal off filesystems mounted below it

find and rm -rf both descend into a filesystem mounted below the state
or volume directories and delete its contents before failing on the
mount point. Unmount such filesystems first, and run the removal with
-xdev and --one-file-system so a missed one stops it with its data kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chris LuandClaude Opus 5.5 committed 2026-12-05 16:52:53 -08:00
1 parent 6fb4dccca6
commit c24e8b23ae
1 file changed
+4 -3
+4 -3
View File
@@ -953,12 +953,13 @@ two hosts, follow the host-by-host order there. Where SeaweedFS was already runn
3. **Remove sw-block.** The removal runs only after the same check succeeds in the same command. A failed query
removes nothing. If section 1 put blockmaster's state on its own filesystem, empty and unmount it first, then
delete its persistent mount configuration (its `/etc/fstab` line): `rm -rf` cannot remove a mount point, so
the removal below would stop there.
the removal below would stop there. Unmount any other filesystem mounted below these directories first:
`-xdev` and `--one-file-system` make the removal stop at such a mount instead of deleting its contents.
```sh
units=$(systemctl list-units 'sw-blockvolume*' 'sw-blockmaster*' --state=active,activating,deactivating --no-legend) &&
test -z "$units" && mountpoint -q /var/lib/sw-block-master &&
sudo find /var/lib/sw-block-master -mindepth 1 -delete && sudo umount /var/lib/sw-block-master
sudo find /var/lib/sw-block-master -xdev -mindepth 1 -delete && sudo umount /var/lib/sw-block-master
```
Then remove everything else:
@@ -966,7 +967,7 @@ two hosts, follow the host-by-host order there. Where SeaweedFS was already runn
```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 -rf --one-file-system /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 &&