NetBSD: How to use automount daemon ‘amd’ to mount flash cards and cdrom

Due to some weird problem with Hal or PolicyKit in NetBSD, I’m not able to mount any SD card, not even my CDROM. So, one solution, more elegant in my opinion, is to use ‘amd’. In FreeBSD it’s pretty easy. In NetBSD I had to work very hard to do it, but, it’s finished.

Ok, let’s go with the code. First create an ‘/etc/amd.conf’ file with the following lines:


[ global ]
print_pid = no
unmount_on_exit = yes
restart_mounts = yes
search_path = /etc
dismount_interval = 5
cache_duration  = 5
browsable_dirs = yes
localhost_address =
log_file = syslog
#log_file = /var/log/amd
#log_options = all
log_options = error

[ /host ]

map_name = /etc/

Then the map files:


* opts:=rw,grpid,resvport,vers=3,proto=tcp,nfs_retransmit_counter=10,nosuid,nodev
localhost type:=auto;fs:=${map};pref:=${key}/

localhost/sd0e type:=program;fs:=/mnt/sd0e;\
mount:=”/sbin/mount mount /mnt/sd0e”;\
unmount:=”/sbin/umount umount /mnt/sd0e”

localhost/sd1e type:=program;fs:=/mnt/sd1e;\
mount:=”/sbin/mount mount /mnt/sd1e”;\
unmount:=”/sbin/umount umount /mnt/sd1e”

localhost/cd   type:=program;fs=/mnt/cd;\
mount:=”/sbin/mount mount /mnt/cd”;\
unmount:=”/sbin/umount umount /mnt/cd”

As you can see, ‘/etc/’ references some mount points that must be appear in ‘/etc/fstab’:

/dev/sd0e       /mnt/sd0e       msdos   rw,noauto,-l,-m=644,-M=755,-u=1000,-g=100
/dev/sd1e       /mnt/sd1e       msdos   rw,noauto,-l,-m=644,-M=755,-u=1000,-g=100
/dev/cd0a       /mnt/cd         cd9660  ro,noauto,-l,-m=644,-M=755,-u=1000,-g=100

Note the user and group id (1000 and 100) are the ids of your user (not root).

I launch ‘amd’ from ‘/etc/rc.conf’:

My pendrive sd0e is mounted in /host/localhost/sd0e. A handy link can be created pointing to that place:

ln -s /host/localhost /media

Or better, creating url links in your desktop (Gnome, XFCE, KDE) pointing to that places:


When you click on that icon (url link) the device will be mounted.

With the default options we have configured, the devices are unmounted 5 seconds after the mount point have been abandoned.

I found this interesting document to learn how to deal with automunt:

But I cloned my FreeBSD configuration for mmc:

Note that /dev/sd0e and /dev/sd1e could not be the devices for your pendrives. Use ‘disklabel’ to find the most suitable device name for your pendrive.

About jjjesss

I'm a guy interested in technology, bsd fan and concerned about the world around.
This entry was posted in BSD, FreeBSD. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s