This document outlines the procedure needed to set up AutoFS, a package that provides support for automount. It provides the ability to have CDs, floppies, and other removable media automatically mounted when they are inserted.
- Install the autofs package:
pacman -Sy autofs
- Edit the file
/etc/autofs/auto.master. Delete the existing contents and add the following line:
And make additional line in the end of the file (press ENTER after last word). If there is no correct EOF line, the AUTOFS daemon won't work properly.
If Autofs doesn't automatically unmount your devices (after you finish this wiki), replace last line by :
/media /etc/autofs/auto.media --timeout 3
- Create the /etc/autofs/auto.media file with the following contents:
cdrom -fstype=iso9660,ro,nodev,nosuid :/dev/cdrom floppy -fstype=auto,async,nodev,nosuid,umask=000 :/dev/fl usbstick -fstype=auto,async,nodev,nosuid,umask=000 :/dev/sda1
You may need to change the devices. You can also add additional similar devices. If you are using DVD-ROM and needs UDF support change the above cdrom line with "-fstype=auto".
- Create the
/etc/default/autofsfile and add the following line to it:
- Open the
/etc/conf.d/autofsfile and edit the daemonoptions line:
- Create the
- Start the autofs daemon using:
- Start this daemon on every boot by adding
autofsto the DAEMONS array in /etc/rc.conf
Devices are now automatically mounted when they are accessed. Visit the /media/cdrom and /media/floppy directories to access them. They will remain mounted as long as you access them.
If you browse to the /media directory in a file manager, you will now see directory entries for the cdrom and floppy. These entries will be present with no media in the drive. This means that in the file browser you can see what drives you may mount, but the directories will be empty at best if no media is present. Apparently not all file managers can handle the case where a directory does not exist.
If you use multiple usb drives/sticks and want to easily tell them apart, you can use Autofs to set up the mount points and udev to create distinct names for your usb drives. Using udev to map multiple entries to a device has instructions on setting up udev rules.
If autofs isn't working for you, make sure that the permissions of the autofs files are correct, otherwise autofs will not start. This may happen if you backed up your configuration files in a manner which did not preserve file modes. Here are what the modes should be on the configuration files:
0644 - /etc/autofs/auto.master
0644 - /etc/autofs/auto.media
0644 - /etc/autofs/auto.misc
0755 - /etc/autofs/auto.net
0644 - /etc/conf.d/autofs
XFCE Volume Manager
For users with the XFCE desktop environment, you might like to consider using the built-in volume manager instead of Automount. Without even needing to have automount installed, xfce can automatically detect, mount and open media, such as usb devices or CDs.
What is it
The volume manager is managed in Thunar, so you will need to be using that, as opposed to XFFM (unless you configure both to run, not covered here). The plugin is called 'Thunar Volume Manager', more information can be obtained from http://foo-projects.org/~benny/projects/thunar-volman/.
Requirements and Installation
- XFCE, with Thunar - Thunar Volume Manager plugin (obtained from http://foo-projects.org/~benny/projects/thunar-volman/) - Dbus - Hal
The plugin can be installed manually, or through pacman with:
sudo pacman -S thunar-volman
After installing the plugin, open the XFCE Settings Manager, and then the File Manager Preferences. Under the 'Advanced' column, check 'Enable Volume Management'. Click configure. Configuration is easy. Here's an example setting for making Amarok play an audio CD.
Multimedia - Audio CDs: amarok --cdplay %d
Having Hal and Dbus running is essential, otherwise the volume manager will not detect anything. This may seem obvious, but I've had several people confused as to why it wasn't working, the issue relating to dbus or hal not running. Also make sure you are part of the HAL and DBUS groups.