Difference between revisions of "Tutorials/AutoMount"

From ThorstensHome
Jump to: navigation, search
(New page: 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 wan...)
 
 
(One intermediate revision by one user not shown)

Latest revision as of 08:30, 13 May 2009

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

Ubuntu

Install autofs:

sudo apt-get install autofs

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-120gb       -fstype=auto            UUID="84ff6790-9b69-4401-9ba2-43d044af1d30"

Start autofs

/etc/init.d/autofs start 

Now you can find your USB disk automatically mounted to /misc/usb-120gb.

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.

SuSE 10.3

  • 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
  • Have a file /etc/auto.master:
/misc   /etc/auto.misc
+auto.master
  • Have a file /etc/auto.misc:
usb             -fstype=auto            :/dev/disk/by-uuid/84ff6790-9b69-4401-9ba2-43d044af1d30
  • Start your automounter:
/etc/init.d/autofs start

Now, as soon as you plug in your USB disk you will find its content under /misc/usb.

See also