docs(block): refuse mounts at removal operand roots

This commit is contained in:
pingqiu committed 2026-12-05 17:31:34 -08:00
1 parent 911890f385
commit 13c19663d9
1 file changed
+4 -2
+4 -2
View File
@@ -963,7 +963,9 @@ two hosts, follow the host-by-host order there. Where SeaweedFS was already runn
the removal below would stop there. Unmount anything else mounted below these directories first, bind mounts
included. `-xdev` and `--one-file-system` stop only at another filesystem: a bind mount from the same
filesystem looks like a plain directory to them, and its source's contents would be deleted. Both commands
below print any such mount and remove nothing while one remains; `findmnt` lists the mounts.
below print nested mounts and remove nothing while one remains; `findmnt` lists the mounts. The final
removal also refuses mounts at the operand roots themselves. The empty-and-unmount step intentionally
allows blockmaster's state mount itself so it can empty and unmount that filesystem first.
```sh
units=$(systemctl list-units 'sw-blockvolume*' 'sw-blockmaster*' --state=active,activating,deactivating --no-legend) &&
@@ -978,7 +980,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" && mounts=$(findmnt -rno TARGET) &&
! printf '%s\n' "$mounts" | grep -E '^/(var/lib/sw-block-(volume|master)|etc/sw-block)/' &&
! printf '%s\n' "$mounts" | grep -E '^/(var/lib/sw-block-(volume|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 \