devd based AUTOMOUNTER

If I understand it right, then auto_master(5) is the configuration file, it comes even with some examples. So it looks not very different from your solution, but might be a bit more difficult to configure.
 
trasz@ is working on updating the man pages and adding more examples. While I have not tried it yet, it looks more to me like amd(8), where a device is mounted when the user tries to access it. Might not be too hard to use devd(8) to detect new devices and mount them on detection.
 
Hello,

I've been using automount 1.4.3 successfully for quite some time on FreeBSD 10.0-RELEASE, FreeBSD 9.3-RELEASE, and FreeBSD 9.2-RELEASE.

When FreeBSD 10.1-RELEASE was released this past week, I installed it on a second hard drive, and set[]up my standard desktop environment with Xfce to do some testing.

I installed automount using ports. I did not compile it with support for any of the special filesystems listed in the configuration options. I only use FAT (MSDOSFS) and UFS.

I made the appropriate changes to the /usr/local/etc/devd/automount_devd.conf file as shown in the thread above:

Code:
notify 100 {
  match "system" "DEVFS";
  match "type" "CREATE";
  match "cdev" "(da|mmcsd)[0-9]+.*";
  action "/usr/local/sbin/automount $cdev attach";
};

notify 100 {
  match "system" "DEVFS";
  match "type" "DESTROY";
  match "cdev" "(da|mmcsd)[0-9]+.*";
  action "/usr/local/sbin/automount $cdev detach";
};
I also have modified the /usr/local/etc/automount.config file as follows:
Code:
USERUMOUNT=YES
ATIME=NO
REMOVEDIRS=YES
FM="thunar"
USER=jda
ENCODING="en_US.ISO8859-1"
CODEPAGE="cp437"
I use this same configuration on my FreeBSD 10.0-RELEASE machine as well.

Using a USB memory stick that is formatted using the following commands (This works with my FreeBSD 10.0-RELEASE install with out any issue):

gpart destroy -F /dev/da0
gpart create -s mbr /dev/da0
gpart add -t \!12 /dev/da0
newfs_msdosfs -F32 /dev/da0s1

Gives me the following in the log file located in /var/log/automount.log when I insert the USB memory stick on my FreeBSD 10.1-RELEASE machine.

Code:
2014-11-16 15:31:22 /dev/da0: attach
2014-11-16 15:31:22 /dev/da0: filesystem not supported or no filesystem
2014-11-16 15:31:22 /dev/da0s1: attach
2014-11-16 15:31:22 /dev/da0s1: filesystem not supported or no filesystem
Any guesses as to what I may be doing wrong here?

I was looking at this again today, and I noticed that the new autofs and associated utilities, that is now included with FreeBSD 10.1-RELEASE, has a system binary in /usr/sbin/ that is named automount. Does this by chance conflict with the script named automount that's installed by /usr/ports/sysutil/automount located in usr/local/sbin/?
 
I was looking at this again today, and I noticed that the new autofs and associated utilities, that is now included with FreeBSD 10.1-RELEASE, has a system binary in /usr/sbin/ that is named automount. Does this by chance conflict with the script named automount that's installed by /usr/ports/sysutil/automount located in usr/local/sbin/?
Nope, no conflict.

The devd(8) uses full PATH for 'mine' automount.

On the other hand, while there are now two 'automounts' in the PATH You will execute (by hand from terminal) the one that is first in PATH, but that does not break the sysutils/automount proper work.
 
After up-dating to 10.1 automount doesn't work.
log:
Code:
2014-12-13 23:14:26 /dev/da0: random wait for '2,0' seconds before 'attach' action
2014-12-13 23:14:26 /dev/da0: attach
2014-12-13 23:14:27 /dev/da0: filesystem not supported or no filesystem
2014-12-13 23:14:27 /dev/da0s1: random wait for '1,0' seconds before 'attach' action
2014-12-13 23:14:27 /dev/da0s1: attach
2014-12-13 23:14:28 /dev/da0s1: filesystem not supported or no filesystem
2014-12-13 23:14:28 /dev/da1: random wait for '1,0' seconds before 'attach' action
2014-12-13 23:14:28 /dev/da1: attach
2014-12-13 23:14:28 /dev/da1: filesystem not supported or no filesystem
automount_devd.conf
Code:
notify 100 {
  match "system" "DEVFS";
  match "type" "CREATE";
  match "cdev" "(da|mmcsd)[0-9]+.*";
  action "/usr/local/sbin/automount $cdev attach";
};

notify 100 {
  match "system" "DEVFS";
  match "type" "DESTROY";
  match "cdev" "(da|mmcsd)[0-9]+.*";
  action "/usr/local/sbin/automount $cdev detach";
};
automount.conf
Code:
USERUMOUNT=YES
ATIME=NO
REMOVEDIRS=YES
FM="xfe"
USER=vg
MNTPREFIX="/mnt/vg"
ENCODING="ru_RU.UTF-8"
CODEPAGE="cp866"
 
Can you mount da0s1? The
Code:
2014-12-13 23:14:28 /dev/da0s1: filesystem not supported or no filesystem
message is very strange.
 
vermaden, I appreciate you taking the time to create and offer a port for this. I've been using it for some time and it's been working great. Dziękuję!

I noticed on the GitHub page you linked to in one of your posts, you have a tarball for a version 1.5(?) vs version 1.43 in the ports tree. Did you have any plans on updating the port in the near future? It is working fine for me as is, but was only curious.
 
vermaden, I appreciate you taking the time to create and offer a port for this. I've been using it for some time and it's been working great. Dziękuję!

Welcome. ;)

I noticed on the GitHub page you linked to in one of your posts, you have a tarball for a version 1.5(?) vs version 1.43 in the ports tree. Did you have any plans on updating the port in the near future? It is working fine for me as is, but was only curious.
I asked one of the FreeBSD Developers to update the port but no luck.
 
To make your program work on 10.1 I had to add -k to Line 287 (v1.5). That is, I had to change
Code:
case $( file -b -L -s ${DEV} | sed -E 's/label:\ \".*\"//g' ) in
to
Code:
case $( file -k -b -L -s ${DEV} | sed -E 's/label:\ \".*\"//g' ) in

Now it works like a charm :)
 
To make your program work on 10.1 I had to add -k to Line 287 (v1.5). That is, I had to change
Code:
case $( file -b -L -s ${DEV} | sed -E 's/label:\ \".*\"//g' ) in
to
Code:
case $( file -k -b -L -s ${DEV} | sed -E 's/label:\ \".*\"//g' ) in

Now it works like a charm :)

I just did this as well, and it's working great for me, too. I was really missing using this on 10.1, and couldn't figure it out.Thanks for the tip!

jda
 
I have one quick question, and maybe a feature idea. How about a ZPOOL on a stick? I find most USB devices to be pretty slow when used with the more traditional file systems but pretty fast when using larger blocks on them. That might speed things up a bit, but I do not want to run FAT with 128KB clusters...
 
I have one quick question, and maybe a feature idea. How about a ZPOOL on a stick? I find most USB devices to be pretty slow when used with the more traditional file systems but pretty fast when using larger blocks on them. That might speed things up a bit, but I do not want to run FAT with 128KB clusters...
Last time I checked file(1) is not able to tell if there is ZFS pool on the device or not.
 
But it doesn't have to be file(1)? zpool --import could be run after the detection of a new storage device. Then, with the output being "0", the script would continue as it does without any ZFS awareness, otherwise switch to ZFS related commands.

Then, for example, if the mountpoints of the newly detected zpool are already used in the running system, some options may be presented, etc. Which is, of course, a whole new chapter :).
 
While ZFS would be a nice feature, unless I'm mistaken, you would have to remember to manually export the pool each time before unplugging the device anyway which kind of negates the usefulness IMO.
 
"I will look into the ZFS detection and automatic mount/umount."

The zpool export -f POOL command is not possible to be executed when the device has been ejected, so its not possible to implement ZFS into sysutils/automount port.
 
Since it is generally a bad idea to unmount a file system after its storage has been removed (wrong order), I don't see the difference as such. Simply removing the media is likely to screw up any file system involved, sometimes terminally. Is the problem in fact that zpool export -f POOL will not remove the hanging filesystem? In that case, this is bad luck indeed.
 
Is the problem in fact that zpool export -f POOL will not remove the hanging filesystem? In that case, this is bad luck indeed.
It's been some time now but doing this caused a hard panic and rebooted my system last time I unwittingly did this. It don't know if this is still the case today. I was using 10-STABLE at the time so it could of course just have been my setup.
 
Yea, bad habit removing USB drive without unmounting it. I know some people who believe "this isn't necessary anymore", what with the striking progress of the MS Win OS :D. I say, such people mustn't be let anywhere close to a ZFS file system or FreeBSD for that matter.
 
Back
Top