devd based AUTOMOUNTER

vermaden vermaden at
Sun Feb 19 21:47:17 UTC 2012


sorry for late response, but I currently have quite a
lot 'weekend activities' that are definitely not near
a computer ;)

written by Gleb Kurtsou ... 
>> __state_lock() {
>>   while [ -f ${STATE}.lock ]; do sleep 0.5; done
>>   :> ${STATE}.lock
>> }
> Why not keep it stateless, unmounting by hand would kill integrity.

The state file is needed for automatic umount of fuse-based mounts,
the device that script would be triggered will be /dev/da0 for example
while the 'virtual' device that was actually used for the mount was
/dev/fuse0, that is why I need to track what is mounted and how.

These functions are mostly to keep that 'state file' integral,
to prevent two various event writing at the file simultanously,
which would probable killed the information integrity.

Unmounting the device does not kill integrity at all, I also thought
about that, You may plug the device, do whatever You want, event
change the filesystem there and mount it again, but when You umount
it and unplug it, then the script will umount that device (yes
pointless here at this moment) and remove the entry from state file.

> Usage of `file` is a big security concern.
Can You explain why?

> I think geom config and list of mounted file systems should be
> sufficient for collecting information at runtime. Although it may not be
> that easy for disks without partitioning.
geom config?

I also make use of the list of mounted filesystems, but the problem
with fuse-based devices remain as I stated earlier.

> I'm using a python script for mounting/unmounting removable disks,
> but having similar tool written in sh would be great.

Thanks for sharing, maybe I will find some ideas there ;)

written by Uffe Jakobsen ...

> Nice,

> Instead of requiring modification to /etc/devd.conf why not just
> put a "plugin" conf-file in /etc/devd/ - well even better put in
> /usr/local/etc/devd/ - that way your devd.conf modifications are
> not lost upon patching/updating base os.
Great advice, I will do that in the next 'release' ;)

> There is an existing port called "automounter" by Dominic Fandrey
> which is much similar to your work.
Yes but its amd based.

> His "automounter" also works with disk labels
> (as found in /dev/ufs/ and /dev/msdosfs/ etc)
The labels are only 'an addition' to appearing device nodes at /dev,
Yes it would be nice to see that /dev/msdosfs/BACKUP is mounted
instead of /dev/da0s1, but I will have to make a lot of additional
check to see if that new label is part of that or other device etc.

> You should consider make a port out of your work.
I probably will try to do that, but I think it stil needs polish ;)

written by Lars Engels ...

> And please don't hardcode polish locales in mount_msdosfs :-)

I already changed that, I also plan to create simple config file,
it was just not 'the most important thing' that I was dealing
with at that time, its easy to move options into variables,
its harder to make script work the way it should ;)

But thanks for suggestion, good point.

written by Joe Culler ...

> Thanks for working on it. It works great for me, thanks!
Thanks, good to know ;)

> I have a question, could you export a fusefs-exfat or
> fusefs-ntfs share directory over NFS? I can't get it work.
> If you have a solution, please let me know, thanks.
I will try to do that tomorrow ane let You know.



More information about the freebsd-stable mailing list