There are two types of automounters in Linux, autofs and AMD. AMD is implemented in user space and not a part of kernel. However, autofs is a newer system assisted by the kernel and it requires kernel lever support. As said before, autofs is implemented in kernel-space, so in order to use autofs the kernel must have support compiled in. AutoFS uses template files for configuration which are located in /etc/autofs The main template is called auto.master, which can point to one or more other templates for specific media types. Open the file /etc/autofs/auto.master with your favorite editor, you will see something similar to this.
Service Name
autofs
Description
This executes auto-mount daemon for filesystem mounting. The “auto-mount” daemon “mounts a filesystem when a client sends a request to this daemon” and “unmount it when there’s no request for a long time”. There are two types of automounters in Linux, autofs and AMD. AMD is implemented in user space and not a part of kernel. However, autofs is a newer system assisted by the kernel and it requires kernel lever support.
Apr 17, 2018 Autofs is an automounter utility that helps you to automatically mount NFS share when a file or directory is requested on the NFS mount point. Auto-mounts are mounted only when they are accessed and are unmounted after a period of inactivity. How Autofs Works. Autofs is a client-side service that automatically mounts the appropriate file system. When a client attempts to access a file system that is not presently mounted, the autofs file system intercepts the request and calls automountd to mount the requested directory. Core animator 1 3 2 – create stunning animations. The automountd daemon locates the directory, mounts it within autofs, and replies.
As said before, autofs is implemented in kernel-space, so in order to use autofs the kernel must have support compiled in. All versions of the kernel starting from 2.2.xx supports autofs. The following command can be used to check if it is compiled in kernel.
The autofs use “maps” to define the filesystem to mount. Different automounters maps are not compatible with each other, eg: amd maps are not compatible with autofs. When autofs starts, it will consult a configuration file /etc/auto.master to find mount points on the system. For each of those mount points a automount process is started with the appropriate parameters. After the auto.master configuration file is processed the autofs will check for an NIS map with the same name.
The autofs should not be used in the system which needs higher performance because dynamic mounting brings some overhead.
The RPM package containing this service are:
Service Control
This service is handled by init.d script /etc/init.d/autofs. Its usage is as follows:
Start the service as follows:
Stop the service as follows:
Check if the service is started or stopped:
Restart will kill running daemons and start the service again.
If the service is started, then restart it; otherwise do nothing.
Reload command will check auto.master map against running daemons. It will kill those daemons whose entries have changed and then start daemon for new or changed entries.
Query runlevel information for the service to check the service boot options after reboot:
Configuration
The autofs automounter uses a configuration file /etc/auto.master to define mount point maps. When starting up, it will check this file and start automount daemons for every entries in this file. For example, the default file comments out all the entries.
Along with /etc/auto.master file, autofs also will check NIS map. If such a map exists then that map will be processed in the same way as the auto.master map.The NIS map will be processed last.
As auto.master file shows, all the mount point maps are partitioned into different categories, such as misc, net etc. Each file contains some maps with detailed mount options. For example, the content of /etc/auto.misc is as follows:
Configuration Files:
NB This information is likely outdated, usbmount does much of this automagically for most use cases.
Automounting removable devices
Here's a short introduction on how to automount various external devices, for example USB sticks, memory card readers, external hard disks etc.
Install required packages
You need to be running a 2.6 kernel for udev to work.
Configure udev
You need to find out some details of the device in question for udev to recognize it properly. Plug in the device you're configuring and check its info using udevinfo command. Snippetslab 1 8 5 x 4. For example, I'm configuring my external USB HDD, which normally appears as /dev/sd? (?=a,b,c..) and I want to be able to identify it uniquely.
udevinfo is missing in Squeeze and Sid. So, use 'udevadm info' instead:
Autofs Ubuntu
We add this info to a rule in /etc/udev/rules.d/custom.rules:
After restarting udev, this configurationmakes udev to create custom links in /dev to pinpoint our devices. Reason refills download free. When I plug in my ipod or external HDD:
Done.
Configuring autofs
By default autofs mounts devices in /var/autofs/. We need to configure it to mount the devices.
/etc/auto.master:
The first field is the path under which autofs mounts the devices. Second field denotes the configuration file for this entry. Last field lists options for this directory: timeout=2 is the minimum timeout until items are unmounted.
/etc/auto.removable:
First field denotes mount point, second field has options (man 5 autofs) and the third field is the device to mount.
Restart autofs and you are ready to go.
Alternatively, use autofs with UUID
This option does not require you to create named /dev entries for your devices with udev.
Edit the file auto.master as described above.
/etc/auto.master:
Create your file that contains the individual disks like this:
/etc/auto.removable:
Whenever the disk with UUID 2a2a2a2a-2a2a-2a2a-2a2a-2a2a2a2a2a2a is plugged into your computer, it will be mounted under /var/autofs/removable/usb. To find the UUID of a disk use either blkid or if not available udevadm.
Autofs Ubuntu 18
- blkid:
- udevadm:
Autofs Ubuntu Download
Note that this requires that the drive is already connected to your computer and you need to replace /sda/sda5 in the examples accordingly.
- Restart your automounter:
Done.
More information
- udev
- How to set up autofs by Kyle Rankin
- AuToFS LQWiki by Linuxquestions
- Autofs on Gentoo Wiki
- Autofs on ArchWiki - Arch Linux Wiki