Hi Chuck,

Chuck Smith:
> These references were helpful to me today!  This answered my last question 
> about how to enumerate aufs branches only.  I learned a lot 
> about /proc/mounts and sys/fs/aufs and their differences between aufs 
> versions.

Oh, I should write some notes about that.
- as you already know, there are differences between aufs versions under
  /sys/fs/aufs.
- when the module parameter 'brs' is set to 1, the branch paths are not
  showen in /proc/mounts. Instead, a new entry /sys/fs/aufs/si_XXXX/brN
  appears.

To get the branch path from a shell script, I'd recommend,,,

(quote from auplink script and arranged)

# the function is defined in /etc/default/aufs
. /etc/default/aufs

# retrieve the mount options
mnt_opts=$(MntOpts "$mntpnt")
si=
eval $(echo "$mnt_opts" |
        tr ',' '\n' |
        grep '^si=')

# extract the path from sysfs or mount options
si_dir=/sys/fs/aufs/si_$si
if [ -r $si_dir/br0 ]
then
        cd $si_dir
        ls -1 br* |
        cut -c3- |
        sort -n |
        sed -e 's/^/br/' |
        xargs -rn 200 cat
        cd $OLDPWD
else
        echo "$mnt_opts" |
        tr ',' '\n' |
        sed -e 's/\\/\\\\/g' |
        egrep '^(dirs=|br:)' |
        tr ':' '\n'
fi |
sed -e 's/=r.*$//'


J. R. Okajima

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/

Reply via email to