Automounter flags for pcfs?

Christopher Sean Hilton chris at vindaloo.com
Fri Sep 29 10:20:17 PDT 2006


On Mon, 2006-09-25 at 11:25 +0200, Ivan Voras wrote:
> The goal is to have a USB flash drive mounted via automounter in a way 
> that it auto-umounts after a while so I don't crash the system by 
> pluggin it out wile mounted. My amd.map looks like this:
> 
> /defaults       type:=host;fs:=${autodir}/${rhost}/host;rhost:=${key};
> *               opts:=rw,grpid,resvport,vers=3,proto=udp,nosuid,nodev
> 
> flash-s1 
> type:=pcfs;dev:=/dev/da0s1;fs:=${autodir}/flash-s1;opts:=rw,longnames,-m664,-M777;
> 
> The problem is that "opts" are not passed to mount_msdosfs which results 
> in all files having execute bits set, etc. Using "msdosfs" instead of 
> "pcfs" makes amd fail with "unknown file system".
> 
> So, how to do this? I'll accept anything that gets the proper flags to 
> mount_msdosfs.
> 

I find that the automounter lacks imagination at times. This makes it
more inflexible than it needs to be. Fortunately the authors provided a
work around in the form of program mounts. I use these two entries in my
amd.map file:

msdos0          type:=program;fs:=${autodir}/${key};\
                        mount:="/sbin/mount mount ${fs}";\
                        unmount:="/sbin/umount umount ${fs}"

ufs0            type:=program;fs:=${autodir}/${key};\
                        mount:="/sbin/mount mount ${fs}";\
                        unmount:="/sbin/umount umount ${fs}"

and these two entries in /etc/fstab:

/dev/da0s1  /.amd/msdos0    msdos   rw,longnames,noauto    0    0
/dev/da0s2e /.amd/ufs0      ufs     rw,nosuid,nodev,noauto 0    0

To get around problems that I have with amd. A little hackish? Yes but
you get complete control over how your filesystem is mounted. The ufs
entry works around the problem of the automounter never timing out a ufs
mount even if you use amq -u.

-- Chris




More information about the freebsd-stable mailing list