mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 02:57:37 +01:00
docs(block): refuse the sw-block removal while a bind mount sits below it
-xdev and --one-file-system compare device numbers, so a bind mount from the same filesystem looks like a plain directory to them and the removal deletes its source's contents. Both removal commands now list mounts below the sw-block directories and remove nothing while one remains. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c24e8b23ae
commit
20d2c3ebf5
1 file changed
+9
-4
@@ -953,12 +953,16 @@ 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. 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.
|
||||
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.
|
||||
|
||||
```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 &&
|
||||
test -z "$units" && mounts=$(findmnt -rno TARGET) &&
|
||||
! printf '%s\n' "$mounts" | grep -E '^/(var/lib/sw-block-(volume|master)|etc/sw-block)/' &&
|
||||
mountpoint -q /var/lib/sw-block-master &&
|
||||
sudo find /var/lib/sw-block-master -xdev -mindepth 1 -delete && sudo umount /var/lib/sw-block-master
|
||||
```
|
||||
|
||||
@@ -966,7 +970,8 @@ 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" &&
|
||||
test -z "$units" && mounts=$(findmnt -rno TARGET) &&
|
||||
! 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 \
|
||||
|
||||
Reference in new issue
Block a user