Hi all!

One of the major annoyances I found in reiserfs is it's really slow
when mounting, and since I'm mounting a lot of partitions on different
disks it takes almost one minute at boot. I thought this could be
improved by substituting the default "mount -a" in rc.sysinit with a
small script that detects the mount dependencies between filesystems
and executes a parallel mount of them.

This would make sense, of course, only on machines that use more than
one partition on more than one disk, but adding a check for this would
be really quick. In case there's only one disk it would default at
"mount -a" without generating the unnecessary overhead.

Well... stop talking. Here comes the script:
----------
#!/bin/bash

# create the array with sorted fs
num=0
for mp in $(grep -v -e ^# -e ^$ -e noauto /etc/fstab | awk '{ print $2
}' | sed 's|^/||' | sort) ; do
        fslist[((num++))]=${mp}
done

# cycle through the array to build the mount line
mountline="mount /"
newnum=1        # set to 1 because it's the root fs
for ((i=1;i<[EMAIL PROTECTED];i++)) ; do
        oldnum=$newnum
        newnum=$(awk -F/ '{ print NF }' <<< ${fslist[$i]})
        if [ ${newnum} -gt ${oldnum} ] && [[ ${fslist[${i}]} =~
${fslist[$((i-1))]} ]] ; then
                conj="&&"
        else
                conj="&"
        fi
        mountline="${mountline} ${conj} mount /${fslist[$i]}"
done

echo $mountline
-----------
I'd like to hear opinions about it, about how it could be improved,
about eventual errors and such. It outputs the line that should be
executed and doesn't touch anything, so, in the form I pasted here, it
is perfectly safe to run it as a standalone script. It is *NOT* (yet?)
intended for execution other than testing, so modify your rc.sysinit
at your own risk.


bardo

_______________________________________________
arch mailing list
[email protected]
http://www.archlinux.org/mailman/listinfo/arch

Reply via email to