Autofs. Share your experience



Well then,thanks anyway, guess I'll give those man pages a more in dept read when I find some time and possibly open a thread if I really don't manage to figure it out
i can see my usb devices from
but its readonly ,when i try to delete a folder or file it shows me that it deleted but when i unplug and plug the usb the file/folder is still there .

any ideas ?
I followed the instructions in post #1 and it was working pretty well. But sometimes nothing new will automount until I flush the cache from the commandline:
automount -c

I have
notify 100 {
        match "system" "GEOM";
        match "subsystem" "DEV";
        action "/usr/sbin/automount -c";

in /etc/devd.conf.

What I mean is, if I unmount a USB stick called, for instance, RESCUE, there is still a folder /media/RESCUE. When I reinsert the stick, it is once again mounted in /media/RESCUE. However, if I insert a different USB stick, called, for instance, STUFF, nothing happens. No new directory /media/STUFF appears until I run automount -c .
Automounting on FreeBSD was always like a black magic for me :D, I tried to make it work
on FreeBSD 10.* several times, but had no luck... sysutils/hal always used to work for me
(it is possible to mount using UTF-8 locale with HAL also), but now it is very outdated
and required by only few ports, and almost all of them may be rebuilt without HAL support,
so hal may be safely removed...

To configure autofs on FreeBSD 11 system, you need to uncomment
/media          -media          -nosuid
in /etc/auto_master.

Then you need to add
to /etc/rc.conf
Then reboot :)

But, with these settings, from handbook, you won't be able to read file names with UTF-8 symbols, like unicode, arabic letters, etc.
(Even if your system locale is a *.UTF-8 locale.)
Also, it won't be possible to edit files on mounted with autofs file systems as a regular user, as root only…

To fix these issues, you need to edit /etc/auto_master again:
/media          -media          -nosuid,-m=770,-L=en_US.UTF-8
-m=770 — changes file permissions on auto mounted with autofs USB flash drives and adds
read-write-execute permissions to the wheel group. So your user should be in the wheel group
(execute # pw groupmod wheel -m [I]yourusername[/I] and re-login).
-L=en_US.UTF-8 — adds UTF-8 support, so all file names are readable now.
Then you need to unmount all autofs devices and restart automount and automountd (or just reboot).

Also it is possible to configure automounting of your MTP device, like android phone, or some mp3 player.
Install sysutils/fusefs-simple-mtpfs, execute # mkdir /mtp and add
/mtp            -simple-mtpfs   -allow_other
to /etc/auto_master, also you need to add
to your /boot/loader.conf, no others configurations needed, all work fine. To load fuse.ko kernel module without reboot, execute # kldload fuse.

When your device will be connected, it will appear in /media or /mtp,
so add these dirs to your file manager bookmarks, when you'll try to open a directory with your device name,
your device will be mounted, `autofs_enable="YES"` loads autofs.ko kernel module and starts 3 services:
automount, automountd and autounmountd, so it will be also auto unmounted "after a period of inactivity".

To unmount all file systems mounted with autofs, execute
# automount -fu
For now I know the only one way how to enable unmounting of FS-es mounted with autofs when using your file manager, like pcmanfm, as a regular user, or via umount command without sudo, execute # chmod 4554 /sbin/umount, also your user should be in "operator" group (execute # pw groupmod operator -m yourusername and re-login), use at your own risk.

After system start, your % mount output should be similar

My phone and mp3 player are auto mounted with autofs, after accessing its mount points.

Do not forget to remove "hald_enable" from /etc/rc.conf.
This is how I use it. May be someone also has any suggestions?

Thanks to tobik@, found that NTFS also can be mounted by autofs,
but sysutils/fusefs-ntfs should be installed.

Also it is possible to mount ext2, ext3, ext4 file systems with autofs,
but ext2fs.ko kernel module should be loaded, so add ext2fs_load="YES"
to /boot/loader.conf, or add ext2fs to kld_list in /etc/rc.conf.

exFAT FS is also supported, just install sysutils/fusefs-exfat:
# cd /usr/ports/sysutils/fusefs-exfat/ && make install clean

No additional actions required. NTFS, ext2fs(5) and exFAT are supported by "media" map in /etc/auto_master,
that was described at the beginning of this post.

"-m=770,-L=en_US.UTF-8" flags are tested to work with msdosfs only, so it may or may not work with NTFS, ext2fs(5) and exFAT.
ILUXA, the /etc/auto_master file would visualize like this for auto-mounting USB devices?

# vi /etc/auto_master
$FreeBSD: releng/12.0/usr.sbin/autofs/auto_master 337749 2018-08-14 13:52:08Z
# Automounter master map, see auto_master(5) for details.
/net -hosts -nobrowse,nosuid,intr
# When using the -media special map, make sure to edit devd.conf(5)
# to move the call to "automount -c" out of the comments section.
# /media -media -nosuid,noatime,autoro
/media -media -nosuid,-m=770,-L=en_US.UTF-8
/mtp -simple-mtpfs -allow_other
#/- -noauto
It is that it does not detect mounted the devices the graphical manager the desktop.
Hmmm, there is some set up involved but I am not on a BSD machine at the moment so can't say what. I believe Vermaden as a howto either here or on the project page. I have never had any issues with his mount app.

Deleted member 48958

ILUXA, the /etc/auto_master file would visualize like this for auto-mounting USB devices?
Yes, you need to add "-m=770,-L=en_US.UTF-8" to "/media" line in /etc/auto_master,
here is how my FreeBSD 12 /etc/auto_master file look like:
# $FreeBSD: releng/12.0/usr.sbin/autofs/auto_master 337749 2018-08-14 13:52:08Z trasz $
# Automounter master map, see auto_master(5) for details.
#/net           -hosts          -nobrowse,nosuid,intr
# When using the -media special map, make sure to edit devd.conf(5)
# to move the call to "automount -c" out of the comments section.
/media          -media          -nosuid,noatime,autoro,-m=770,-L=en_US.UTF-8
/mtp            -simple-mtpfs   -allow_other

FYI, this thread is 2 years old...
Anyway it's working fine for me on FreeBSD 12 as well.