aboutsummaryrefslogtreecommitdiff
path: root/init.d/localmount.in
diff options
context:
space:
mode:
authorRick Farina (ZeroChaos) <sidhayn@gmail.com>2014-10-06 11:15:44 -0500
committerWilliam Hubbs <w.d.hubbs@gmail.com>2014-10-06 16:24:44 -0500
commitad770d739cd7d68dd16b4b2e23d4822ebeb3305b (patch)
tree0330492dd9a4710fbf4e5dfefc04c40666bf4330 /init.d/localmount.in
parent866501be1c554de074533ee98400124393d7fe9d (diff)
localmount: unmount aufs branches
Diffstat (limited to 'init.d/localmount.in')
-rw-r--r--init.d/localmount.in25
1 files changed, 25 insertions, 0 deletions
diff --git a/init.d/localmount.in b/init.d/localmount.in
index bf3dd0fb..1335aa94 100644
--- a/init.d/localmount.in
+++ b/init.d/localmount.in
@@ -63,6 +63,31 @@ stop()
. "$RC_LIBEXECDIR"/sh/rc-mount.sh
+ if [ "$RC_UNAME" = Linux ] && [ -d /sys/fs/aufs ] ; then
+ #if / is aufs we remount it noxino during shutdown
+ if mountinfo -q -f '^aufs$' / ; then
+ mount -o remount,noxino,rw /
+ sync
+ fi
+
+ local aufs_branch aufs_mount_dir aufs_mount_point aufs_si_dir aufs_si_id
+ for aufs_si_dir in /sys/fs/aufs/*; do
+ aufs_mount_dir=${aufs_si_dir#/sys/fs/aufs/}
+ aufs_si_id="$(printf "%s" $aufs_mount_dir | sed 's/_/=/g')"
+ aufs_mount_point="$(mountinfo -o ${aufs_si_id})"
+ for x in $aufs_si_dir/br[0-9][0-9][0-9]; do
+ aufs_branch=$(sed 's/=.*//g' $x)
+ eindent
+ if ! mount -o "remount,del:$aufs_branch" "$aufs_mount_point" > /dev/null 2>&1; then
+ ewarn "Failed to remove branch $aufs_branch from aufs \
+ $aufs_mount_point"
+ fi
+ eoutdent
+ sync
+ done
+ done
+ fi
+
# Umount loop devices
einfo "Unmounting loop devices"
eindent