simple automount script

killasmurf86 said:
I you ask me, then No....
Personally I don't want auto-anything :D

amd does nothing until you deliberately access the device. It's not like it does anything behind your back.

And unlike a specialized script, amd is easily configured to handle nfs exported filesystems, ufs snapshots, etc,
 
Guess that automounter have relation with jalla's first post?
I installed sysutils/automounter and made this:
My /etc/amd.removable
Code:
/defaults    opts:=intr,nosuid  
cd0          opts:=ro;type:=cdfs;dev:=/dev/cd0
# usb devs with fatXX partitions are usually whole disk
da0          opts:=rw;type:=pcfs;dev:=/dev/da0
da1          opts:=rw;type:=pcfs;dev:=/dev/da1
# but sometimes just the first slice (extend as necessary)
da0s1        opts:=rw;type:=pcfs;dev:=/dev/da0s1
da1s1        opts:=rw;type:=pcfs;dev:=/dev/da1s1

My /etc/amd.conf
Code:
[global]
auto_dir = /a
cache_duration = 60   
log_file = /var/log/amd
 
[/r]
map_type = file
map_name = amd.removable

My /etc/rc.conf
Code:
amd_enable="YES" 
amd_flags="-F /etc/amd.removable"

What is wrong? My usb shouldn't now be seen on /media? Is da0s1
 
Forget about sysutils/automounter for now.
With amd running see if you can access the device with, say, ls /r/da0s1/
(the trailing '/' is significant)

I'm not familiar with automounter, but if you want to use it you must at least disable amd and set automounter_enable="YES" in /etc/rc.conf. See the man page for details
 
Is amd running? Check /var/log/amd for any problems.

Also the output from amq(8)() should show something like this
Code:
snapper:/h/tl# amq
/       root    "root"              
/net    toplvl  /etc/amd.net        /net
/snap   toplvl  /etc/amd.snap       /snap
/r      toplvl  /etc/amd.removable  /r
 
sk8harddiefast said:
Guess that automounter have relation with jalla's first post?
I installed sysutils/automounter and made this:
My /etc/amd.removable
Code:
/defaults    opts:=intr,nosuid  
cd0          opts:=ro;type:=cdfs;dev:=/dev/cd0
# usb devs with fatXX partitions are usually whole disk
da0          opts:=rw;type:=pcfs;dev:=/dev/da0
da1          opts:=rw;type:=pcfs;dev:=/dev/da1
# but sometimes just the first slice (extend as necessary)
da0s1        opts:=rw;type:=pcfs;dev:=/dev/da0s1
da1s1        opts:=rw;type:=pcfs;dev:=/dev/da1s1

My /etc/amd.conf
Code:
[global]
auto_dir = /a
cache_duration = 60   
log_file = /var/log/amd
 
[/r]
map_type = file
map_name = amd.removable

My /etc/rc.conf
Code:
amd_enable="YES" 
amd_flags="-F /etc/amd.removable"

What is wrong? My usb shouldn't now be seen on /media? Is da0s1

With automounter you don't need to change any config file.
Use a stock amd.map, don't start amd(8) manually, just add
Code:
automounter_enable="YES"
to /etc/rc.conf.
Then insert the USB device, go to /media/msdosfs/$label and the device is mounted automatically. Some seconds after the last access to a file in /media/msdosfs/$label is made, the device gets unmounted.
 
Check with

pgrep amd

amq will also tell you if amd is running or not
Code:
snapper:/h/tl# amq
amq: localhost: RPC: Program not registered

To start it

/etc/rc.d/amd start
 
lme@ said:
You might also give sysutils/automounter a try.

I read the manpages and it's not clear to me how (or even if it's possible) to incorporate different types of mounts with automounter. Say I'm running amd like this

amd /r /etc/amd.r /snap /etc/amd.snap /net /etc/amd.net

to automount local removable drives, any local ufs snapshots, and any available nfs filesystem respectively.

Can automounter handle this?
If so, what should the amd.map look like?
 
Back
Top