# Autofs. Share your experience



## Deleted member 48958 (Jun 9, 2017)

Automounting on FreeBSD was always like a black magic for me , 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 
	
	



```
autofs_enable="YES"
```
 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 _yourusername_ 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 
	
	



```
fuse_load="YES"
```
 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 `# chown root:operator /sbin/umount` and then `# 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?


*UPDATE:*
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.


*Note:*
"_-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.


----------



## rigoletto@ (Jun 11, 2017)

Mine was not good. I will try it again with the extra changes you pointed out and report later. 

Thanks!

EDIT: added in the extra tips you pointed out and I had a improvement. Now when the device is mounted I can use it properly. It appear automatically in x11-fm/pcmanfm-qt. 

The mtp seem to not be working, but I still need to look if it is not a Android issue.


----------



## Deleted member 48958 (Jun 12, 2017)

Do not forget to load fuse.ko kernel module, to make simple-mtpfs work,
add 
	
	



```
fuse_load="YES"
```
 to /boot/loader.conf, or 
	
	



```
kld_list="fuse"
```
 to /etc/rc.conf, to load it immediately, execute `# kldload fuse`.
(Also do not forget to install sysutils/fusefs-simple-mtpfs port!)
Also check your phone connection settings, it should be in mtp mode.

And be sure to add

```
/mtp            -simple-mtpfs   -allow_other
```
to /etc/auto_master and reboot.


----------



## rigoletto@ (Jun 12, 2017)

ILUXA

I have


```
kld_list="fuse"
```
in /etc/rc.conf, I will try to load fuse directly from /boot/loader.conf instead.

sysutils/fusefs-simple-mtpfs is installed and the phone is correct configured, however I use a custom ROM and so I am willing to test using another phone to be certain of the result.

Thanks!


----------



## rigoletto@ (Jul 4, 2017)

Hum. Just now I found this error:


```
Jul  3 21:32:22 workstation automountd[33906]: failed to execute /etc/autofs/special_simple-mtpfs: No such file or directory
Jul  3 21:32:22 workstation kernel: WARNING: autofs_trigger_one: request for /mtp/ completed with error 5
Jul  3 21:32:22 workstation automountd[33905]: "/etc/autofs/special_simple-mtpfs", pid 33906, terminated with exit status 1
Jul  3 21:32:22 workstation automountd[33905]: failed to handle special map "-simple-mtpfs"
Jul  3 21:32:22 workstation automountd[33905]: AUTOFSDONE: No such process
```

`pkg info | grep mtp`

```
fusefs-simple-mtpfs-0.3.0_1    Simple MTP fuse filesystem driver
libmtp-1.1.13                  Media Transfer Protocol (MTP) library
```

Thanks!


----------



## Deleted member 48958 (Jul 4, 2017)

lebarondemerde said:


> Jul 3 21:32:22 workstation automountd[33906]: failed to execute /etc/autofs/special_simple-mtpfs: *No such file or directory*


Hmm, It seems "/etc/autofs/special_simple-mtpfs" isn't exist in your system...
What version of FreeBSD you're using? I am 100% sure that special_simple-mtpfs is present in FreeBSD 11 Stable,
and, as I remember, it is also present in 11 Release too.


----------



## Deleted member 48958 (Jul 4, 2017)

sysutils/fusefs-simple-mtpfs installs /etc/autofs/special_simple-mtpfs!
https://bz-attachments.freebsd.org/attachment.cgi?id=146220: 





> if exists(/etc/autofs)
> PLIST_FILES+=	*/etc/autofs/special_simple-mtpfs*
> SUB_FILES+=	special_simple-mtpfs
> .endif



Just tested. It seems you didn't install this port, because it installs special_simple-mtpfs to /etc/autofs/ dir.
If it is already installed, try to reinstall it: 
	
	



```
# pkg ins -f sysutils/fusefs-simple-mtpfs
```


----------



## rigoletto@ (Jul 4, 2017)

That is weird. I am using 11.0-RELEASE-p1, and I have sysutils/fusefs-simple-mtpfs installed. I see the patch-src__simple-mtpfs-fuse.cpp and special_simple-mtpfs.in inside the port file folder, however it is not being installed. 

I will look in the build log to see if there is something.

Thanks!

EDIT: nothing interesting from logs but the Makefile point to PR 193596, but if installing from packages the file appear in there.

EDIT2: Thread 54690/page-37#post-354122


----------



## rigoletto@ (Jul 4, 2017)

The sysutils/fusefs-simple-mtpfs was solved, or more like workarounded. As pointed in the Thread 54690/page-37#post-354124 it is/was the port fault.

Thanks!


----------



## willbprog127 (Jul 6, 2017)

ILUXA Thank you for your detailed information!

Unfortunately automount doesn't work very good for me when it comes to MTP devices (all different Android devices).  Unfortunately I've had to switch to Debian for my daily OS for now because there doesn't appear to be a _reliable_ way to access my various Android devices on FreeBSD.  I've tried sysutils/automount and I've tried audio/gmtp and both have failed in one degree or another, even after much experimentation.  

It grieves me that I cannot just plug in an Android phone or tablet on FreeBSD and have it automatically appear in the file manager (caja, pcmanfm, etc) as it (usually) does in Linux...and then not even Linux gets it right sometimes.  I've actually had to forward some of my Android device connections to Windows running in a virtual machine to get the files copied -- not fun, or cool.


----------



## rigoletto@ (Jul 8, 2017)

willbprog127

I do not know about audio/gmtp but sysutils/automount does not support mtps, as you can see here.


----------



## rigoletto@ (Jul 8, 2017)

ILUXA

Is there a reason to mounting `mtpfs` at /mtp instead of /media?

I am asking because if it is not mounted at /media, x11-fm/pcmanfm-qt do not show it in the device section. I changed it to there and it is working quite fine here.


----------



## Deleted member 48958 (Jul 8, 2017)

lebarondemerde said:


> Is there a reason to mounting  mtpfs at /mtp instead of /media?







It is not a best idea if you plan to mount msdosfs devices also (USB flash drives, etc). If you'll use mtpfs only (without 
	
	



```
/media          -media          -nosuid
```
 line in /etc/auto_master) then it can work. But also /mtp dir may be mentioned somewhere in autofs scripts... 
Also I am not a some kind of pro/developer or something  , I'm a regular user like you, so just test.


Also /etc/autofs/special_simple-mtpfs says:

```
# Intended for use with /etc/auto_master containing
# /mtp          -simple-mtpfs   -allow_other
```
So maybe there is some reason for this...

So my advice to you, just create a bookmark to /mtp with your file manager.


----------



## abishai (Jul 15, 2017)

I have some question concerning autofs.
1. How can I prevent EFI partition available in /media
2. How to unmount ? I have permission denied when I try to click unmount in thunar. Set suid bit to `umount` is a little bit messy.
3. I'm not wheel. Can I set username in auto_master ?


----------



## Deleted member 48958 (Jul 20, 2017)

1. ?
2. Use `# automount -fu`
3. You can try to use "-m=777" flag instead of "-m=770".


----------



## rigoletto@ (Jul 20, 2017)

Unfortunately I end up moving to sysutils/dsbmd & sysutils/dsbmc. AutoFS does not play well with x11-fm/pcmanfm-qt, it sometimes unmount but immediately mount again...

I am waiting to Lumina split to several ports so I can install its tools separated. It is already possible but no one did it yet, and they do not know when they will have time for.

The Lumina fm should deal well with AutoFS. I give a try to it yesterday, did not test the AufoFS, but it have a nice integration with ZFS - _how ever it seem still a bit buggy_. 

So, I am looking forward...


----------



## Deleted member 30996 (Jul 20, 2017)

I've used sysutils/automount and sysutils/automounter in conjunction with success.

However, I found automount more of a hindrance than a boon as I prefer a USB stick not be mounted automagically in case I want to use the dd command.


----------



## rigoletto@ (Jul 21, 2017)

Trihexagonal

sysutils/dsbmd does not mount automatically, and that is for what sysutils/dsbmc is in there - and/or sysutils/dsbmc-cli.

You can find all dsb project here.


----------



## Deleted member 30996 (Jul 21, 2017)

lebarondemerde said:


> You can find all dsb project here.



Thanks for the link. I've never used it but it looks nice.



abishai said:


> I have some question concerning autofs.
> 2. How to unmount ? I have permission denied when I try to click unmount in thunar. Set suid bit to `umount` is a little bit messy.
> 3. I'm not wheel. Can I set username in auto_master ?



I always make my usr account a member of wheel during the build process and use the mount and unmount commands:

`# mount -v -t msdosfs /dev/da0s1 /media/da0s1

# umount -v -t msdosfs /dev/da0s1 /media/da0s1`


----------



## abishai (Jul 22, 2017)

I ended using sysutils/dsbmd  I don't like the idea to have separate folders for sticks, mtp and ptp devices as autofs needs. Also, it mounts my EFI partition.

Lumina looks promising, but it's dependency on x11/xscreensaver is disaster. Just give me blank screen without 50 perl deps.


----------



## Deleted member 48958 (Jul 23, 2017)

abishai said:


> Also, it mounts my EFI partition.


It won't mount it until you'll open its mount point (/media/EFI/),
if this dir won't be opened, EFI won't be mounted, so you can use /media/ content safely,
without mounting /media/EFI/. But even if this directory will be accidentally opened and mounted,
it will be automatically unmounted after some time with autounmountd daemon, which is started  by _autofs_enable="YES"_.


----------



## abishai (Jul 24, 2017)

sysutils/dsbmd pauses computer shutdown for 1 min. (Stopping dsbmd .... waiting for PIDS on tty0).

/var/log/messages

```
Jul 24 22:05:22 sphinx shutdown: reboot by root:
Jul 24 22:05:22 sphinx console-kit-daemon[933]: WARNING: Error waiting for native console 9 activation: Inappropriate ioctl for device
Jul 24 22:05:22 sphinx devd: notify_clients: send() failed; dropping unresponsive client
Jul 24 22:05:23 sphinx kernel: , 789.
Jul 24 22:06:22 sphinx kernel: .
Jul 24 22:06:22 sphinx kernel: .
Jul 24 22:06:22 sphinx ntpd[774]: dispatch_imsg in main: pipe closed
Jul 24 22:06:22 sphinx devd: notify_clients: send() failed; dropping unresponsive client
```
789 is daemon pid, but other errors are not related, I saw them before.


----------



## rigoletto@ (Jul 24, 2017)

abishai

I do not have this problem, but your messages show a consolekit ioctl(2) error. Try disabling consolekit to see if it will still hang for a minute.

I do not use consolekit, but as you already are using consolekit maybe sysutils/hal would be a better option for you.


----------



## abishai (Jul 25, 2017)

lebarondemerde said:


> abishai
> 
> I do not have this problem, but your messages show a consolekit ioctl(2) error. Try disabling consolekit to see if it will still hang for a minute.
> 
> I do not use consolekit, but as you already are using consolekit maybe sysutils/hal would be a better option for you.


hal is dead for a decade  And consolekit is not related to hal.
I think, consolekit error is unrelated and harmless, 'unresponsive client' is dhcp client, it becomes upset when ipsec goes down. Relevant messages are from kernel (1 minute). Probably, I should look in sources  Very strange that only dsbmd is slow to stop.


----------



## mrclksr (Jul 25, 2017)

abishai said:


> sysutils/dsbmd pauses computer shutdown for 1 min.



Hi abishai ,

I've never seen this problem before. I don't want to hijack the thread, but what version of dsbmd are you using? Maybe there is an unresponsive device which is polled by dsbmd. If you're using dsbmd >= 0.3, you can disable polling by setting `poll_interval = 0` in /usr/local/etc/dsbmd.conf, and see if the problem persists.


----------



## abishai (Jul 26, 2017)

mrclksr said:


> Hi abishai ,
> 
> I've never seen this problem before. I don't want to hijack the thread, but what version of dsbmd are you using? Maybe there is an unresponsive device which is polled by dsbmd. If you're using dsbmd >= 0.3, you can disable polling by setting `poll_interval = 0` in /usr/local/etc/dsbmd.conf, and see if the problem persists.


I use latest version available in ports, to it is > 0.4 I suspect the problem is gvfs node for compatibility with posix applications.

```
/dev/fuse on /home/abishai/.gvfs (fusefs, local, nosuid, synchronous, mounted by abishai)
```
I think, ~/.gvfs enumeration should be disabled in dsbmd. gvfs tries to mount this folder if user has necessary rights (write access to /dev/fuse and vfs.usermount).


----------



## Deleted member 48958 (Jul 26, 2017)

abishai said:


> dsbmd


Please *stop*, this thread is not about dsbmd, it's about autofs.


----------



## rjohn (Jul 27, 2017)

when i plug a usb stick with ntfs file system ,i cant open it in KDE4(dolphin file manager) ,i get the error :





(have already done the above instructions) the only way to mount it manual is with the command : 
	
	



```
ntfs-3g /dev/da0s1 /mnt/flash
```
still cant see it in file manager but i can see files in /mnt/flash
any way to fix this(skip executing the command) ?

my rc.conf : 
	
	



```
sshd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="NO"
dbus_enable="YES"
hald_enable="YES"
kdm4_enable="YES"
ipv6_network_interfaces="none"
ipv6_activate_all_interfaces="NO"
ip6addrctl_policy="ipv4_prefer"
ip6addrctl_enable="NO"
autofs_enable="YES"
portmap_enable=YES
portmap_flags="-h 127.0.0.1"
amd_enable=YES
amd_flags="-a /.amd_mnt -c 10 -w 2 -l syslog /host /etc/amd.map"
fusefs_enable="YES"
```

have tryed as well with 
	
	



```
#hald_enable="YES"
```
should i make it

```
hald_enable="NO"
```
 ?


----------



## rigoletto@ (Jul 27, 2017)

rjohn 

To appear in the file manager it usually need to be mounted at /media instead of /mnt, as pointed in the ILUXA  tutorial.


----------



## Deleted member 48958 (Jul 27, 2017)

rjohn said:


> ntfs


ntfs is not supported. So it seems it is not possible to mount it with autofs, as far as I know (I've never tried.).
Only fat32 and devices with mtp support. So just use fat32 on your flash drives for compatibility with FreeBSD and Windows machines.


----------



## rjohn (Jul 28, 2017)

thank you both for your comments ,i have to figure how trueOS has done it,their automount works fine with fat32 and ntfs


----------



## rigoletto@ (Jul 28, 2017)

ILUXA 

Does AutoFS not mount it if sysutils/fusefs-ntfs is installed?


----------



## tobik@ (Jul 28, 2017)

Yes, ntfs can be mounted with autofs. /etc/autofs/special_media handles it. But sysutils/fusefs-ntfs has to be installed and fuse.ko has to be loaded.


----------



## Deleted member 48958 (Jul 28, 2017)

Checked /etc/autofs/special_media and found that ext2fs(5) also seems to be supported
(ext2fs.ko kernel module should be loaded). As well as "exfat" (but sysutils/fusefs-exfat should be installed).
Didn't find out it before, because I don't use Windows or GNU/Linux anywhere. Added to the first post in this topic.


----------



## Sensucht94 (Jul 29, 2017)

tobik@ said:


> Yes, ntfs can be mounted with autofs. /etc/autofs/special_media handles it. But sysutils/fusefs-ntfs has to be installed and fuse.ko has to be loaded.



Yes, for me,  it works out of the box; my external memory storage has never failed to be mounted , and my secondary hard drive, with a NFTS partition, is correctly automounted as well


----------



## rjohn (Aug 21, 2017)

found that ext2fs_load="YES" , causes my fat32 usb sticks not working with autofs





automounting works ,everything is mounted in the /media/daXXsXX
but i cant write on ntfs.

fusefs-ntfs is installed
fuse.ko is loaded

```
$ kldstat
Id Refs Address            Size     Name
 1   63 0xffffffff80200000 1f67a88  kernel
 2    1 0xffffffff82169000 4d18     coretemp.ko
 3    1 0xffffffff8216e000 1a8c8    fuse.ko
```

any ideas?


----------



## Sevendogsbsd (Oct 19, 2017)

OK, forgive my problem that is opposite to everyone else's  I would like to NOT mount the ntfs volumes in my workstation because I dual-boot with windows and have no need to have these disks mounted while I am in FreeBSD. I have read the man page on auto_master() but am probably doing this wrong. Is there a configuration that prevents automounting of certain disks? It appears the "-null" parameter or flag I read about in the auto_master() documentation can do this but it is not clear how. I don't have an issue with mounting these drives but boot takes forever because it appears the drives are being checked for consistency and I do not need this to happen.

Thanks in advance.


----------



## Deleted member 48958 (Oct 19, 2017)

Just do not install/remove sysutils/fusefs-ntfs, and NTFS shouldn't be mounted with autofs.


----------



## Sevendogsbsd (Oct 19, 2017)

I thought of that, good old occam's razor . I didn't do it because automount is a dependency but maybe I am confusing autofs and automount. 2 separate things?

 Thanks Iluxa.


----------



## Deleted member 48958 (Oct 19, 2017)

Sevendogsbsd said:


> autofs and automount 2 separate things


Yes. autofs is a part of base system, while sysutils/automount is a separate port.
It is two different things.


----------



## cabriofahrer (Dec 7, 2017)

For me autofs does not work at all. I do

`#service hald stop`
`#service automount onestart`
`#service automountd onestart`
`#service autounmountd onestart`
`#cd /media`
`#ls`

and this is what I get:


```
WARNING: autofs_trigger_one: request for /media/ completed with error 5
WARNING: autofs_trigger_one: request for /media/ completed with error 5
WARNING: autofs_trigger_one: request for /media/ completed with error 5
WARNING: autofs_trigger_one: request for /media/ completed with error 5
WARNING: autofs_trigger_one: request for /media/ completed with error 5
```

When I plug in an USB-Stick nothing happens, output looks like this:


```
$ mount
/dev/ada0p2 on / (ufs, local, soft-updates)
devfs on /dev (devfs, local, multilabel)
/dev/ada1p2 on /Disk2 (ufs, local, soft-updates)
fdescfs on /dev/fd (fdescfs)
procfs on /proc (procfs, local)
linprocfs on /compat/linux/proc (linprocfs, local)
tmpfs on /tmp (tmpfs, local)
map -media on /media (autofs)
/dev/fuse on /usr/home/werner/.gvfs (fusefs, local, nosuid, synchronous, mounted by werner)
```

My /etc/auto_master looks like this:


```
$ more /etc/auto_master
# $FreeBSD: releng/11.1/etc/auto_master 310007 2016-12-13 04:44:06Z dteske $
#
# 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
#/media -fstype=cd9660 :/dev/cd0
#/-             -noauto
```

I would like to automount optical media, too, so would the outcommented line be OK?


----------



## Deleted member 48958 (Dec 7, 2017)

cabriofahrer said:


> For me autofs does not work at all. I do
> 
> #service hald stop
> #service automount onestart
> ...



All you need to do, to make it work:
1. Uncomment _media_ line in /etc/auto_master.
2. Add _autofs_enable="YES"_ to /etc/rc.conf.
3. Reboot.

Also it is possible to add sysutils/fusefs-simple-mtpfs support to autofs, check this.


----------



## cabriofahrer (Dec 7, 2017)

The media line was already uncommented, please have another look at my original post. I also tried adding some options like suggested in the other thread to make it look like this:


```
$ more /etc/auto_master
# $FreeBSD: releng/11.1/etc/auto_master 310007 2016-12-13 04:44:06Z dteske $
#
# 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,-m=770,-L=en_US.UTF-8
#/media -fstype=cd9660 :/dev/cd0
#/-             -noauto
$
```

Please note that the media line is uncommented, just as above. I also added _autofs_enable="YES" in my /etc/rc.conf and set hald_enable="NO"_, and rebooted, but this is just the same as starting the services manually. In console mode (without starting X) I also realized the following message in addition to the one originally stated above:

failed to handle special map "-media".


----------



## Deleted member 48958 (Dec 7, 2017)

For me it works as described above,
so I don't know why it's not working for you...
Just a guess, is /media directory exist in your system?
after adding all settings, your mount output should be similar:





You don't need to launch something manually after adding _autofs_enable="YES"_ to /etc/rc.conf.


----------



## cabriofahrer (Dec 7, 2017)

ILUXA said:


> Just a guess, is /media directory exist in your system?



Of course it does, without it HAL would not work either. I do get the same output as you when I do a $mount. But what I am saying is that when I plug in a USB-Stick or a CD, nothing happens. They should be listed in `&mount`, too, right? And they should appear in the media directory also, but they don't. When I do a `&ls /media` nothing is in there.

I can only tell you this: My system has always been updated with freebsd-update since the first fresh installation years ago with 9.0 or even 8.x, I don't remember now. But that should not be a problem, I hope. My output is:


```
$ uname -a
FreeBSD amd64.my.domain 11.1-RELEASE-p4 FreeBSD 11.1-RELEASE-p4 #0: Tue Nov 14 06:12:40 UTC 2017     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
```


----------



## Deleted member 48958 (Dec 7, 2017)

Try this, it may help, may be you got device permissions problems.
This is what I use, create /etc/devfs.rules with

```
[system=10]
[b]add path 'da*'          mode 0660[/b]
add path 'mmcsd*'       mode 0660
add path 'pass*'        mode 0660
add path 'xpt*'         mode 0660
add path 'ugen*'        mode 0660
add path 'usbctl'       mode 0660
add path 'usb/*'        mode 0660
add path 'fd/*'         mode 0660
```
 inside

And add 

```
devfs_system_ruleset="system"
```
to /etc/rc.conf.

("_add path 'da*'          mode 0660_" is your USB flash drives permissions)

Your user should be in _operator_ and _wheel_ group.
Execute
`# pw groupmod wheel -m yourusername`
and
`# pw groupmod operator -m yourusername`

Then relogin and execute `# service devfs restart`.


----------



## Sensucht94 (Dec 7, 2017)

ILUXA said:


> This is what I use, create /etc/devfs.rules with
> 
> ```
> [system=10]
> ...



ILUXA actually adding `add path 'da*s*'` ( `add path 'da*p*'` for flash drives containing a BSD slice) sort many issues out in my case, whereas bare '*da*' * had failed granting me write permissions on automounted  devices.


All things considered I have to say I'm satisfied with autofs.  With FUSE I automount mount EXT4 -ro, exFAT USB stick and NTFS external drive -rw without issue. I can also mount HFS using sysutils/hfsutils, when I boot in someone's Mac through a USB stick. Only my XFS Linux-home partition l ends up being umountable on desktop,  but really, no harm done.


However, despite having thoroughly looked auto_master(5) over, I still don't know whether I managed to understand or not how it works for real (mountpoints, direct/indirect/special maps). For example, does specifying a custom mountpoint in /etc/auto_master require a custom map? I specified *-media *as special map since it seemed the most obvious choice, but then apparently no change was applied and /media remained always as automount point even when the corresponding entry in auto_master was commented.

I ended up giving ownership for /media to my standard user and creating a simlink on desktop pointing to it.

It a long time now (years), I'm doing this that way, and I'm fine as lonh as it works, but I was looking for a more proper solution...do if anyone is so kind to enlight me on that I would definitely appreciate it


----------



## Deleted member 48958 (Dec 8, 2017)

Sensucht94 said:


> ILUXA actually adding  add path 'da*s*'


There is no need to add 'da*s*', it should work OK with 'da*' with all USB flash drives.


----------



## Sensucht94 (Dec 8, 2017)

ILUXA said:


> There is no need to add 'da*s*', it should work OK with 'da*' with all USB flash drives.


Well then, guess it was some wrong permission set the first time I tried. It was a long ago, and I was a beginner, I've never tried to see whether simple da* would have worked ir not from that moment on.
By the way, have you ever tried setting a custom mount point, preferably inside /usr/home/user?


----------



## Deleted member 48958 (Dec 8, 2017)

Sensucht94 said:


> have you ever tried setting a custom mount point, preferably inside /usr/home/user?


No.


----------



## Sensucht94 (Dec 8, 2017)

ILUXA said:


> No.


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


----------



## rjohn (Jun 25, 2018)

i can see my usb devices from
	
	



```
/media/
```
 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 ?


----------



## romanaOne (Jul 17, 2018)

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`.


----------



## teo (Jul 11, 2019)

ILUXA said:


> Automounting on FreeBSD was always like a black magic for me , 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,
> ...


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.


----------



## Sevendogsbsd (Jul 11, 2019)

Vermaden's sysutils/automount has always worked great for me. I thought autofs was more appropriate for things like remote NFS mounts? No?

FYI, this thread is 2 years old...


----------



## teo (Jul 11, 2019)

Sevendogsbsd said:


> Vermaden's sysutils/automount has always worked great for me. I thought autofs was more appropriate for things like remote NFS mounts? No?
> 
> FYI, this thread is 2 years old...


Testing  it with sysutils/automount  and does not detect the auto-mounting of USB devices  on the  pcmanfm file manager in Lxde.


----------



## Sevendogsbsd (Jul 11, 2019)

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 (Jul 11, 2019)

teo said:


> 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
```



Sevendogsbsd said:


> FYI, this thread is 2 years old...


Anyway it's working fine for me on FreeBSD 12 as well.


----------

