1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
summary: observe how mount --r?bind works with stacked mounts
details: |
A given path may contain more than one mount point. A multitude of file
systems may all be mounted at the exact same location. What happens when
mount --bind or --rbind is asked to replicate one of the mounts elsewhere?
environment:
BIND/bind: bind
BIND/rbind: rbind
prepare: |
mkdir a
mount -t tmpfs tmpfs-a-X a
mount --make-shared a
mount -t tmpfs tmpfs-a-Y a
mount -t tmpfs tmpfs-a-Z a
mkdir b
# Here $BIND may be either "bind" or "rbind".
mount --"$BIND" a b
restore: |
umount -l a
umount -l a
umount -l a
rmdir a
umount -l b
rmdir b
debug: |
cat /proc/self/mountinfo
execute: |
# Second-to-last field is the source device.
# This shows our custom names for each tmpfs mounted above.
tail -n 4 /proc/self/mountinfo | awk '{ print $(NF-1) }' >actual.txt
diff -u actual.txt expected.txt
|