Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Feb 2012 21:18:44 +1100 (EST)
From:      Ian Smith <smithi@nimnet.asn.au>
To:        vermaden <vermaden@interia.pl>
Cc:        freebsd-stable@freebsd.org, lars.engels@0x20.net, Hans Petter Selasky <hselasky@c2i.net>
Subject:   Re: devd based AUTOMOUNTER
Message-ID:  <20120226203949.H89643@sola.nimnet.asn.au>
In-Reply-To: <dusvifyxcdqegubftcgz@lvhf>
References:  <hkubftdrahxmtuzcfqzh@ziad> <4F3EE186.4020801@gmail.com> <uhhupehcnrebtwjfedhg@xlkc> <201202181409.08859.hselasky@c2i.net> <evbvqmovseenzzafkvdy@cufm> <dusvifyxcdqegubftcgz@lvhf>

next in thread | previous in thread | raw e-mail | index | archive | help
Ccs mightily trimmed to avoid not-subscribed bounces; readd as desired:

On Mon, 20 Feb 2012 09:43:59 +0100, vermaden wrote:
 > To: freebsd-hackers@freebsd.org
 > Cc: matt <sendtomatt@gmail.com>, gleb.kurtsou@gmail.com,
 >     freebsd-stable@freebsd.org, uffe@uffe.org, joe.culler@gmail.com,
 >     Hans Petter Selasky <hselasky@c2i.net>, freebsd-current@freebsd.org,
 >     lars.engels@0x20.net
 > 
 > Hi,
 > 
 > new version with new features (and BUGs ;p)
[..]

Well, I was busy composing this reply a few days ago when this system 
was taken out by a very near lightning strike .. losing the ADSL modem 
(blown into 4 pieces scattered about the room :), 2 scorched switches, 
the old xe pccard interface feeding the ADSL (its dongle also blown into 
several pieces), and a good deal of travelling - I was 80km remote at 
the time - but very fortunately not the server box itself .. close call!

 > Added 'noatime' as a default mount option when possible.

Good idea for many use cases, but could that be optional?

[..]
 > Added config file to be used from /usr/local/etc/automount.conf file, possible options are (these are defaults):
 >   MNTPREFIX="/media"
 >   LOG="/var/log/automount.log"
 >   STATE="/var/run/automount.state"
 >   ENCODING="en_US.ISO8859-1"
 >   CODEPAGE="cp437"
 >   DATEFMT="%Y-%m-%d %H:%M:%S"
 >   USERUMOUNT="NO"
 > 
 > Mine config currently has only these:
 >   ENCODING="pl_PL.ISO8859-2"
 >   CODEPAGE="cp852"
 >   USERUMOUNT="YES"
 > 
 > The USERMOUNT otions if set to YES (default to NO) will 'chmod +s /sbin/umount',
 > so You can click the ^ button on the devices list in NAUTILUS.

Someone might explain why I needn't feel a bit uncomfortable about that 
chmod, even though it is optional, and even though I've been guilty 
myself of a 'chown root:nobody /sbin/tc' on a linux firewall box ..

 > These newly mounted devices appear on NAUTILUS sidebar (only with /media prefix).

I wonder how it goes with KDE4? (still 3.5 here, which wouldn't count)

[..]
 > /usr/local/sbin/automount.sh
 > -------------------------------------------------------------------------------
[..]
 > [ "${USERUMOUNT}" = "YES" ] && chmod u+s /sbin/umount # /* WHEEL group member */
 > 
 > __create_mount_point() { # /* 1=DEV */
 >   MNT="${MNTPREFIX}/$( basename ${1} )"
 >   mkdir -p ${MNT}
 >   chown 1000 ${MNT}
 > }

Er, who's user 1000 ?  Another config item perhaps?  Or should that be 
the particular user currently invoking the script via devd (if that can 
be determined?)?  Also, are you using sysctl vfs.usermount=1 ?

 > case ${2} in
 >   (attach)
 >     for I in /dev/${1}*
 >     do
[..]
 >         (*Unix\ Fast\ File*)
 >           __create_mount_point ${I}
 >           fsck_ufs -y ${I}

Mmm, fsck on every attachment?  Maybe running fsck should be optional?  
We might be attaching, perhaps, a 2TB backup HD? ..

 >           __check_already_mounted ${MNT}
 >           mount -o noatime ${I} ${MNT}

Again, I'd rather see that optional in an intended system tool, although 
it's an option I'd tend to use myself.

 >           __log "${I}:mount (ufs)"
 >           ;;
[..]
 >   (detach)
 >     MOUNT=$( mount )
 >     __state_lock
 >     grep ${1} ${STATE} \
 >       | while read DEV PROVIDER MNT
 >         do
 >           TARGET=$( echo "${MOUNT}" | grep -E "^${PROVIDER} " | awk '{print $3}' )
 >           [ -z ${TARGET} ] && {
 >             __state_remove ${MNT} ${STATE} ${LINE}
 >             continue
 >           }
 >           umount -f ${TARGET} &
 >           unset TARGET
 >           __state_remove ${MNT} ${STATE} ${LINE}
 >           __log "${DEV}:umount"
 >         done
 >     __state_unlock
 >     __log "/dev/${1}:detach"
 >     find ${MNTPREFIX} -type d -empty -delete

I don't see the need to remove all empty subdirs of, say, /media - this 
tool may not be the only thing wanting to manage that space?  Removing 
directories that were added by this tool itself makes sense of course.

Looks like a neat gadget, don't mind me picking up on a few aspects :)

cheers, Ian



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120226203949.H89643>