Mr. Junjiro R. Okajima,
please take a look at the following shell function and the two lines
from /proc/mounts:
handle_filesystems()
{
# $1 = new journal commit time in seconds
while read DEV MOUNT FSTYPE REST;
do
command_exists "handle_${FSTYPE}" || continue
printf "Setting journal commit time for %s to %d..." \
"$MOUNT" "$1"
"handle_${FSTYPE}" $MOUNT $1 && echo Done. || \
echo Failed.
done < /proc/mounts
}
/dev/sda11 /tmp/jailcache.ro.var ext3
rw,relatime,errors=continue,barrier=0,data=ordered 0 0
varonaufs /tmp/jail/var aufs
rw,relatime,si=89f694af8e016535 0 0
- First line:
while read DEV MOUNT FSTYPE REST;
After read DEV MOUNT FSTYPE REST the variables contains the
following values:
DEV == /dev/sda11
MOUNT == /tmp/jailcache.ro.var
FSTYPE == ext3
REST == rw,relatime,...
command_exists "handle_ext3" || continue
|
true The function handle_ext3() exists in the
| script journal-commit.
\|/
print "Setting journal commit time for %s to %d..." \
"/tmp/jailcache.ro.var" "0"
"handle_ext3" /tmp/jailcache.ro.var 0 && echo Done. || echo Failed.
The function name handle_ext3 is the name of the function
handle_ext3(). This function is a part of the script
journal-commit:
handle_ext3()
{
# $1 = filesystem to remount
# $2 = commit time
remount_fs $1 "commit=${2}"
}
The output of handle_ext3() with $1 = /tmp/jailcache.ro.var and
$2 = 0 is:
remount_fs /tmp/jailcache.ro.var "commit=0"
remount_fs()
{
# $1 = filesystem to remount
# $2 = mount option to change
mount -o remount,$2 $1
}
The output of remount_fs() with $1 = /tmp/jailcache.ro.var and
$2 = "commit=0" is:
mount -o remount,commit=0 /tmp/jailcache.ro.var
The above command is called only if the contents of FSTYPE is ext3.
- Second line:
while read DEV MOUNT FSTYPE REST;
After read DEV MOUNT FSTYPE REST the variables contains the
following values:
DEV == varonaufs
MOUNT == /tmp/jail/var
FSTYPE == aufs
REST == rw,relatime,...
command_exists "handle_aufs" || continue
|
false The function handle_aufs() doesn't exists in
| the script journal-commit.
\|/
while read DEV MOUNT FSTYPE REST; <- read the next line from
/proc/mounts
In this case a remount isn't executed.
Regards,
Robert Wotzlaw
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure