Kevin Oberman
2016-Jan-25 20:10 UTC
Auto-mounting USB NTFS formatted devices on FreeBSD 10.2 and HEAD
Thanks, all! Especially to Lars and Edward Tomasz who actually understood my request (which was probably less clear than it should have been) and provided the exact incantation required! Kevin Oberman, Part time kid herder and retired Network Engineer E-mail: rkoberman at gmail.com PGP Fingerprint: D03FB98AFA78E3B78C1694B318AB39EF1B055683 On Sun, Jan 24, 2016 at 11:37 PM, Lars Engels <lars.engels at 0x20.net> wrote:> On Sun, Jan 24, 2016 at 04:50:13PM -0800, Kevin Oberman wrote: > > Since the removal of NTFS support, it is unclear how to get USB drives > > formatted as NTFS (or ExFAT) to automatically mount. Prior to FreeBSD 10 > it > > was possible to replace /sbin/mount_ntfs with a script that would > generate > > appropriate options and exec /usr/local/sbin/ntfs-3g and let HAL fire up > > mount_ntfs, but that no longer works as mount_ntfs is no longer used and > > mount(8) no longer treats '-t ntfs' as special. > > > > It would appear that automount(8) would be the right magic, but it's not > > obvious to me how to configure it to recognize that an NTFS device has > been > > connected to a USB port (as opposed to msdosfs) and to use ntfs-3g to do > > the actual mount. I assume that the same issue exists for ExFAT. > > > > Does anyone have an idea of what magic is required in the auto_master or > > elsewhere to make this work in conjunction with devd? I'd really like to > > avid using hald, if possible. > > It's pretty easy: > > > - Install fusefs-ntfs > - Enable autofs: > # sysrc autofs_enable=YES > # sysrc autounmountd_flags="-t 10" # unmount after 10s of inactivity > - Make sure to add this to /etc/auto_master: > /media -media -nosuid > - Then you need this little patch for /etc/autofs/special_master: > > --- special_media.bak 2016-01-19 11:00:55.766975000 +0100 > +++ special_media 2016-01-20 11:29:56.205575000 +0100 > @@ -59,7 +59,16 @@ > continue > fi > > - echo "-fstype=${_fstype},nosuid :/dev/${_p}" > + if [ ${_fstype} = "ntfs" ]; then > + if [ -f "/usr/local/bin/ntfs-3g" ]; then > + echo > "-mountprog=/usr/local/bin/ntfs-3g,fstype=${_fstype},nosuid > :/dev/${_p}" > + else > + /usr/bin/logger -p info \ > + "Cannot mount ${_fstype} formatted > device /dev/${_p}: Install sysutils/fusefs-ntfs first" > + fi > + else > + echo "-fstype=${_fstype},nosuid :/dev/${_p}" > + fi > done > > # No matching device - don't print anything, autofs will handle it. > > - Start auto$foo: > # service automountd start > # service automounter start > # service automountd start > > - Insert the NTFS device > - Look for a new directory in /media > - Access it > > It's working for me on HEAD, but I guess you should be also successful on > STABLE > > > -- > Lars >