From ad770d739cd7d68dd16b4b2e23d4822ebeb3305b Mon Sep 17 00:00:00 2001 From: "Rick Farina (ZeroChaos)" Date: Mon, 6 Oct 2014 11:15:44 -0500 Subject: localmount: unmount aufs branches --- init.d/localmount.in | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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 -- cgit v1.2.3