Difference between revisions of "Automounter tutorial"
imported>ThorstenStaerk |
(/etc/init.d/autofs no longer exists) |
||
(9 intermediate revisions by 3 users not shown) | |||
Line 4: | Line 4: | ||
This example assumes you want to plug in a [[USB]] [[disk]] and have it mounted on /misc/usb. | This example assumes you want to plug in a [[USB]] [[disk]] and have it mounted on /misc/usb. | ||
− | + | * [[install autofs]] | |
− | |||
− | |||
− | |||
− | Find out your USB disk's UUID: | + | * Find out your USB disk's UUID: |
[[hwinfo]] --block | [[hwinfo]] --block | ||
[...] | [...] | ||
Line 17: | Line 14: | ||
bel/DATALUX | bel/DATALUX | ||
− | + | == Configure autofs == | |
Have a file /etc/auto.master like this: | Have a file /etc/auto.master like this: | ||
/misc /etc/auto.misc --timeout=60 --ghost | /misc /etc/auto.misc --timeout=60 --ghost | ||
Line 26: | Line 23: | ||
usb -fstype=auto UUID="''84ff6790-9b69-4401-9ba2-43d044af1d30''" | usb -fstype=auto UUID="''84ff6790-9b69-4401-9ba2-43d044af1d30''" | ||
− | + | == Start autofs == | |
− | /etc/init.d/autofs start | + | systemctl start autofs || /etc/init.d/autofs start |
Now you can find your USB disk automatically mounted to /misc/usb. | Now you can find your USB disk automatically mounted to /misc/usb. | ||
− | === | + | == Make it persistent == |
− | * You can find log entries from automounter NOT in | + | Now, as soon as you plug in your [[USB]] disk you will find its content under /misc/usb. If you want this setting to persist after reboots, run the [[command]]: |
+ | [[chkconfig]] autofs on | ||
+ | |||
+ | = TroubleShooting = | ||
+ | * You can find log entries from automounter NOT in dmesg but in /var/log/messages. | ||
* If your [[device]] is already mounted, automount may not mount it again. This means you will also have to stop other automounters like gnome-volume-manager. | * If your [[device]] is already mounted, automount may not mount it again. This means you will also have to stop other automounters like gnome-volume-manager. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
[[Category:Guides]] | [[Category:Guides]] |
Latest revision as of 14:58, 15 August 2015
autofs, also called automounter or automount, allows you to connect storage media like a USB disk and have it mounted automatically. For example, if you have two USB disks, and you want to have one mounted as usb-120gb and the other as usb-80gb as soon as you plug them in, this is possible with autofs.
Contents
QuickStart
This example assumes you want to plug in a USB disk and have it mounted on /misc/usb.
- Find out your USB disk's UUID:
hwinfo --block [...] Device Files: /dev/sdc1, /dev/disk/by-id/usb-Myson_Century,_Inc._USB_Mass_Stor age_Device_100-part1, /dev/disk/by-path/pci-0000:00:1d.7-usb-0:3:1.0-scsi-0:0:0: 0-part1, /dev/disk/by-uuid/84ff6790-9b69-4401-9ba2-43d044af1d30, /dev/disk/by-la bel/DATALUX
Configure autofs
Have a file /etc/auto.master like this:
/misc /etc/auto.misc --timeout=60 --ghost
This will create all mount points beneath /misc. The mount points will appear even if they are not active ("ghosts").
Create a file /etc/auto.misc like this:
usb -fstype=auto UUID="84ff6790-9b69-4401-9ba2-43d044af1d30"
Start autofs
systemctl start autofs || /etc/init.d/autofs start
Now you can find your USB disk automatically mounted to /misc/usb.
Make it persistent
Now, as soon as you plug in your USB disk you will find its content under /misc/usb. If you want this setting to persist after reboots, run the command:
chkconfig autofs on
TroubleShooting
- You can find log entries from automounter NOT in dmesg but in /var/log/messages.
- If your device is already mounted, automount may not mount it again. This means you will also have to stop other automounters like gnome-volume-manager.