'automount' is an alternative mechanism to mount local
and networked media automatically. In this contributed article, Mandrake
Linux user Kevin McCormick describes a setup.
This is based on my reading of the man pages for autofs
and also the Automount mini-HOWTO, plus a few trial and error cycles. Your
mileage may vary. I use Linux-Mandrake, and the "Supermount" method they
have for accessing removable drives wasn't working for me.
I have found the method described below to be quite usable. Notice that 'automount'
doesn't work with 'urpmi' or the 'Software Manager' when installing RPMs
('device is busy' error).
Anyone who has better ideas should feel free to add
improvements.
- Run urpmi autofs as 'root' to install
the package (or use the Software Manager').
- Enable the 'autofs' service via the Mandrake Control
Center - System - Services. Alternatively, run (as 'root'): chkconfig
autofs on to make sure the automounter is started automatically upon
boot. (More on system services)
-
Disable 'supermount' by running (as 'root') supermount
-i disable
section index top
Create mount directories as 'root' with mkdir /mnt/dir_name
(as 'root'). Directories such as '/mnt/cdrom', '/mnt/floppy', and '/mnt/zip'
may have already been created, and you may just want to use these. (More on 'mounting')
These directories can be located anywhere in your tree but are usually placed
under '/mnt', as in '/mnt/cdrom'.
A separate directory for each removable drive should
be created because you will probably want to use different timeout (auto
unmount) options for each removable drive. However, if the timeout option
is the same, you can simply use a mount point for more than one removable
drive.
Here, I could use a single mount point for the cdrom and zip drives.
section index top
Next edit the '/etc/auto.master' file
# For details of the format look at autofs(8). # mount point config file --options # my layout: # NFS link to server is under /net # removable drives are under /mnt/cd, mnt/fd, and mnt/zd /net /etc/auto.net --timeout=30 #(this is a network nfs share) /mnt/floppy /etc/auto.floppy --timeout=1 /mnt/cdrom /etc/auto.cdrom --timeout=3 /mnt/zd /etc/auto.zip --timeout=3
Next create an '/etc/auto.drivereference' file for each
removable drive reference in '/etc/auto.master'.
----------------
Example file for /etc/auto.zip which mounts under '/mnt/zd'
# $Id: auto.misc,v 1.2 1997/10/06 21:52:04 hpa Exp $ # This is an automounter map and it has the following format # key [ -mount-options-separated-by-comma ] location # Details may be found in the autofs(5) man page #==== /etc/auto.zip (has 3 second timeout) zipd -fstype=vfat,users,rw,suid :/dev/hdd zipl -fstype=ext2,users,rw,suid :/dev/hdd1
Note there are two zip drive directories, one for dos
(vfat) formatted zip drives and one for linux (ext2) formatted drives. Since
they mount to different partitions on the zip drive, it appears separate
entries are necessary. See the mini HOWTO on
zip drives.
-----------------
Example file for /etc/auto.cdrom which mounts under '/mnt/cdrom'
#==== /etc/auto.cdrom (has 3 second timeout) cdrom -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom
----------------
Example file for /etc/auto.floppy which mounts under '/mnt/floppy'
#==== /etc/auto.floppy (has 1 second timeout) floppy -users,suid,rw,exec,fstype=auto, :/dev/fd0
----------------
Example file for '/etc/auto.net' NFS network file share which mounts under
'/net' (if you don't share NFS directories in your network, don't use this).
#==== /etc/auto.net nfs1 -fstype=nfs,rsize=4096,wsize=4096,hard,intr server_name:/share_name
section index top
Next edit the desktop icons (if you use these) on your
desktop which reference the removable drives. These icons are perhaps labeled
"CD-ROM", "Floppy", and "Zip".
For KDE, just right-click the desktop icon and select
"Properties" from the pop-up menu. This displays a small dialog and you should
click on the "URL" tab to show the URL (uniform resource locater). Edit the
URL to be the same as the '/etc/auto.master' mount point plus the 'auto.removabledrive'
directory name. Following the examples, the URL for the cdrom drive would
be: "/mnt/cdrom/cdrom", for the floppy drive: "/mnt/floppy/floppy", and for
the zip drive: "/mnt/zd/zipl" or "/mnt/zd/zipd".
Now when you click on these icons, the Konqueror file
manager will open and display the contents of the removable drive. If there
is no disk in the drive when you click on the icon, you will get an harmless
error message.
When you are done with the removable drive, close the
Konqueror file manager so that there are no active programs with a reference
to the directory. After the timeout has elapsed, the removable drive will
be automatically unmounted and the removable disk can be taken out without
having to worry about files that are not synced or other such annoying problems.
In order to access a removable drive directly from the
Konqueror file manager, you will need to type the path (e.g. '/mnt/cdrom/cdrom')
in the Location bar at the top. If you are using Konsole, xterm, or another
terminal emulator, you also just type the path (e.g. $ cd /mnt/cdrom/cdrom).
'autofs' will automatically mount the removable drive
when the path is given and when there are no programs referring to the drive,
it will automatically unmount after the timeout period has elapsed.
Mandrake Linux user James Coliz prefers a slightly different
approach:
Once I got it up and running, I found it extraordinarily
cumbersome to have my floppy on '/auto/floppy/floppy', and my CD on '/auto/cdrom/cdrom'.
I'd like to recommend that people consolodate into a
single map file.
Here's my '/etc/auto.master':
/auto /etc/auto.drives --timeout=2
And my /etc/auto.drives:
zip -fstype=vfat,user,rw,suid,uid=root,gid=local,umask=7007
:/dev/zip
cdrom -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom
floppy -fstype=vfat,user,rw,suid,uid=root,gid=local,umask=7007 :/dev/fd0
Sure they all have the same timeout. But the access
is so much simpler...
section index top
|