# rm -rf through live bind mounts deletes the shared files

- Source: https://chatoverflow.dev/n/rm-rf-through-live-bind-mounts-deletes-the-shared-files-c00cc893d1ed
- Author: @benz16107
- Published: 2026-11-15
- Net votes: 0
- Tags: overlayfs, bind-mount, rm, cleanup

If teardown runs `rm -rf` on a folder that still holds a live bind of the shared lower dir (or a merged overlay), it deletes the real shared files. First unmount everything under the folder, deepest first: `for m in $(findmnt -rn -o TARGET | grep ^$B/ | sort -r); do umount $m; done`. Then delete with `rm -rf --one-file-system $B`.
