Revision / Modified: Jan. 09, 2001
Author: Tom Berger
Original documents:
http://www.mandrakeuser.org/docs/admin/amount.html
http://www.mandrakeuser.org/docs/admin/amount2.html
http://www.mandrakeuser.org/docs/admin/amount3.html
http://www.mandrakeuser.org/docs/admin/amount3.html
If you are coming from a non-Unix operating system like MS Windows 9.x or the 'classic' Mac OS, one of the main obstacles of getting to grips with Linux is its different handling of partitions, removable media and network shares (from now on referred to as 'media').
In those operating systems, partitions play a more or less prominent role in tasks related to files and directories. You have several 'drives' in Windows (e.g. A:, C:, D: etc) or 'Volumes' in Mac OS. Applications install to a folder of their own, dropping off one or more files in the 'system directories' of these operating systems. New partitions, external media or network shares appear as new 'drives' or 'volumes'.
In Unix, and thus in Linux, things are handled almost entirely differently.
This is because in contrast to the later Mac OS and Windows operating systems,
Unix systems have been developed as multi-user operating systems: usually
there were one or more central servers accessed by users via their terminals.
Often directories were distributed: the users' home directories were on
machine A, the executables and libraries on machine B etc. Users were usually
not allowed to install their own applications, they'd rather have asked the
system administrator to install an application for them on the main
server.
Something like the file systems on Mac OS and Windows with their rather
arbitrary 'volume' and 'drive' naming, their separate application directories
and their non-continuous directory structure would have been an administrative
nightmare.
Linux has inherited the characteristics of the Unix file system:
One of the very first ideas which started Mandrake Linux off from Red Hat was to make media easier to access for users. Back in the old days, you had to be 'root' to mount a medium and something as simple as installing an RPM from a CD was quite tedious: switch to 'root' account, insert CD, mount CD, install program, unmount CD, switch back to user account. Gets really old really fast.
Of course, this restriction makes perfectly sense in a multi-user
environment with a system administrator where you don't want everyone to be
able to muck around with the system but it is more or less ridiculous on
single user machines.
Therefore are all removable media configured to be user (un)mountable in
Mandrake Linux. With the introduction of 'supermount' in Mandrake Linux 7.2,
to be discussed later, even mounting these media is done automatically (if you
are using 8.1, read this
hint on 'supermount'). Furthermore are all locally available Windows 9x
partitions set up to be accessible (read-write) by users and are mounted
automatically at boot time.
KDE and GNOME come with icons for removable drives. Mounting a medium via these icons is as simple as inserting the medium and clicking the icon. If you don't have 'supermount', you have to remember to unmount the medium via the right click content menu of the icon before removing it from the device.
Mandrake Linux also provides the DiskDrake tool which allows you to configure local and networked mounts as well as resize partitions. DiskDrake is available as a graphical module of the Mandrake Control Center (Hardware - Mount Points) but can also be run on the console.
If you want to know all the gory details, however, you're welcome to read on ;-).
The idea behind 'mount' is pretty simple: we use a command to tell the system which media it should integrate into the tree or which it should remove. This way the system will always know which media are accessible and which are not.
A simple
$ mount
will provide you with a list of media currently mounted. If you have any Windows 9x partitions on your system, these will usually be already mounted, too (directories '/mnt/win_drive).
In order to mount a medium ('to make it part of the local directory tree'), you have to be 'root' and you have to provide it with some facts about the medium you want to mount: what the medium is and via which directory of the directory you want to access it:
# mount device_name mount_point
To unmount, you use the 'umount' command:
# umount mount_point
An example: to mount an MS-Windows partition ('vfat') which resides on the first partition of the first IDE-disk to '/mnt/disk', you'll type (as root):
# mount /dev/hda1 /mnt/disk
To unmount:
# umount /mnt/disk
Easy, isn't it? ;-) Take this step by step.
In Unix and thus in Linux, everything is regarded as a file. All file and input/output operations are handled via files. Devices (hard disks, keyboards, graphic cards, printers etc) are also handled via files. These device files are located in the '/dev' directory. All read and/or write operations to and from devices go via these files. If you print a document, the data is simply sent to the device file of your printer in '/dev', if you save a file, that data is sent to the device file of the partition you save it to.
Device names follow strict conventions, which means that on all Linux
systems each specific device has always the same device file.
The allowed device file names are listed in
'/usr/src/linux/Documentation/devices.txt' (online
copy).
Common device names are:
These are devices connected via IDE (hard disks and their partitions, CD-R,
internal ZIP etc). The letter describes the position of the device on the bus
(a=master on first IDE channel, b=slave on first IDE channel, c=master on
second channel etc.).
The number describes the position of the partition. If the medium does not
feature partitions (CD-Rs or DVDs for example), it simply doesn't require that
number. A CD drive which is master on the second IDE channel has just
'/dev/hdc' for its device file (or '/dev/cdrom' which in turns links to
'/dev/hdc').
Everything that has partitions has their device names subdivided in names according to the partitions available (device name + partition number). The master hard disk on the first IDE channel has the device file '/dev/hda'. The first partition on that disk has the device name '/dev/hda1', the second '/dev/hda2' etc.
Things are a bit different, however, when Windows is installed on the same disk. Windows 9x is based on MS-DOS and thus can't handle more than one of the four 'primary' partitions available. Therefore further partitions ('drives') in Windows are created as so-called 'extended partitions' in one of the four 'primary partitions'. In Linux, the first 'extended' partition is always labeled as '5', even if one or more of the 'primary partitions' isn't used:
/dev/hda1 (...) b Win95 FAT32 /dev/hda2 (...) f Win95 Ext'd (LBA) /dev/hda5 (...) b Win95 FAT32 /dev/hda6 (...) 83 Linux
As you can see, the first partition is used by Windows 9x, which must be installed on the first primary partition. The second provides the structure for the 'extended partitions' (it's of no use by itself). '/dev/hda5' is the second Windows partition ('D:'), and Linux lives on '/dev/hda6', despite the fact there are only three 'real' partitions on the disk.
Why it's done this way? Because this way there's no device name shift in case another primary partition gets created. This new partition would get the device name '/dev/hda3'.
As you can see, a maximum of 63 partitions per disk is allowed.
These are the floppy devices, with '0' being the first drive and '7' being the eight.
SCSI disk devices. Numbering like IDE. Maximum of 15 partitions per disk. Notice that USB and IEEE1394 hard disks are also handled via these devices files.
SCSI CD-Rom devices, nowadays usually referred to as '/dev/scdx'. 0= first device, 1= second device etc. IDE CD-Roms are handled via '/dev/hd'. Notice that IDE CD burners as well as all USB and IEEE 1394 CD/DVD/CD-R are handled via these device files, too.
Parallel port IDE devices. Partitions as with IDE. Maximum of 15 partitions.
Parallel port ATAPI disk devices.
To find out what partitions are available on a device, either use 'diskdrake' from the Mandrake Control Center (Hardware - Mount Points), or type
# cfdisk -P s /dev/device_name
as 'root'. E.g. to find out about the first IDE hard disk in a system, you'd type cfdisk -P s /dev/hda.
Notice that upon installation Mandrake Linux configures a few mnemonic links like '/dev/cdrom' which points to the 'real' CD-R device file. You can create such links, too. If you have a ZIP which mounts to '/dev/sda4', you can - as 'root' - create a link like this one:
# ln -s /dev/sda4 /dev/zip
Now you can use '/dev/zip' as an alternative device file name for that ZIP.
Many explanations and tutorials on 'mount' mention the -t type option to specify the file system on the medium. You will find that for mounting local file systems, providing this option isn't necessary. 'mount' supports auto-detection for most of the supported local file systems.
# mount /dev/hda1 -t vfat /mnt/disk
mounts the first partition on the first IDE hard disk to '/mnt/disk' and tells 'mount' which file system to expect ('vfat', the file system used by Windows 9x), instead of letting it figure it out on its own.
The -t option does have its use when mounting or unmounting multiple media at once:
# umount -a -t vfat
for example unmounts all media with a Windows FAT file system on them.
This is a directory a medium is mounted to. If the medium is mounted, its
content is accessible via this directory like with any other directory. If the
medium isn't mounted, this directory is just an ordinary empty directory. You
can even copy files into this empty directory. These files however will
disappear when a medium gets mounted to this directory and reappear when the
medium gets unmounted. From this it should also be clear that one directory
can only be host to one mounted medium at any given time, you can
however mount a medium to a directory on a mounted medium.
Notice that the access permissions on these directories do not have
any influence on the permissions of mounted media.
If you have a look at the 'diskdrake' module or the file '/etc/fstab', you notice that two types of mounts can be distinguished by their mount points: one type is mounted to directories across the system ('/', '/home', '/usr', '/dev' etc), while the other type has their mount directories in the '/mnt' directory. The first type is integral part of the system, whereas the second is regarded as temporary (e.g. removable media, Windows partitions, network shares).
The reason for this distinction is easy to conceive: this makes it much easier to exclude temporary media from backups or system maintenance jobs, like for example the update of the database for the 'locate' command.
Usually you won't need the -o options argument for the mount command. The default options are sensible, and for everything beyond you'd use the '/etc/fstab' file (to be discussed later).
'mount' basically has two sets of options for every 'mount' command: a set of general options applicable to all file systems (like -o ro for mounting a medium read-only, and a set of file system specific options (like -o codepage=850 to enable a special character conversion on a mounted Windows partition). Options are separated by a comma, no spaces. Read man mount for a complete listing.
Like the -t option, -O (capital O) can be used to (un)mount multiple media at once:
# mount -a -O umask=0
for example mounts all media from '/etc/fstab' which have the 'umask=0' option in their entry. -t and -O can also be used together with -a:
# umount -a -t vfat -O ro
unmounts all media with the Windows FAT file system on them which are mounted read-only.
The central configuration file for the 'mount' command is '/etc/fstab'. You can either use 'diskdrake' (Mandrake Control Center - Hardware - Mount Points) to make changes to that file, or edit the file directly as 'root'.
'/etc/fstab' has several uses:
You can determine which media to mount automatically on boot.
You can specify fixed mount options and mount points for every medium.
The system uses it to mount several 'virtual' file systems.
By default, all media listed in 'fstab' are mounted on boot. If a medium isn't available, 'mount' will print an error message and continue with the next entry. Notice that this also applies to networked media like NFS or SMB shares. To prevent 'mount' from trying to mount a medium on boot time, you have to supply the 'noauto' option to the entry of that medium in '/etc/fstab'.
If you've read the previous page, you already know that the 'mount' command has two sets of options: a set of general options and a set specific to each file system.
File system specific options are file system specific. Really ;-) If you
supply an entry in 'fstab' with an option which is specific to a file system
(for example umask=0
, specific to the Windows FAT file system),
only media with this file system can be mounted via this entry. If you need to
mount media with different file systems on the same device, either refrain
from using file system specific options or create an entry for every file
system.
Specifying a mount point has the advantage that you don't have to supply the device file name to the (u)mount command any longer.
mount mount_point
will look up the entry with the respective mount point in '/etc/fstab' and access the listed device file.
Depending on system configuration, 'fstab' contains a number of entries for 'virtual file systems'. These entries do not have corresponding device files listed. Whatever you do, don't mess with these entries!
'proc' mounts the 'process tree' under '/proc' which provides a slew of information on what's going on on your system.
'pts' enables 'pseudo terminal support', a Unix compatibility feature.
'shm' enables support for 'POSIX shared memory'. Only used by a few programs, but doesn't hurt.
You see that there are already entries in '/etc/fstab' for your system partitions like '/'. Have a look at one of them:
/dev/hda3 / ext2 defaults 1 1
The syntax is:
/dev/hda3 / ext2 defaults 1 1 device_name mount_point file_system options 'dumpe2fs' 'fsck'
So there's the device name of the medium (here the partition on a disk),
the mount point ('/') and the file system ('ext2').
defaults
collects a set of 'mount' options: rw
allow
read/write, suid
allow set-user-identifier, exec
allow execution of programs, auto
mount on boot,
nouser
can only unmounted by root, and async
allows
delayed disk accesses (caching).
The last two options are flags for the file system utilities 'dumpe2fs' and
'fsck'.
The 'dump' field is either set to '1' (enable) or '0' (disable). Since 'dump'
is used by backup programs for the ext2 / ext3 file system only, '1' is set
just with entries for ext2 / ext3 media. All other media use '0'.
The 'fsck' field can either be set to '0' (disable file system check), '1'
(check first) or '2' (check). '0' is set for all media with non-Linux file
systems, removable and networked media, and virtual file systems. '1' is set
for the '/' entry, since this partition has to be mounted (and thus checked)
first and '2' for all other non-removable, local media with Linux file
systems.
Removable data storage like CDs needs different options (if you are not using 'supermount'):
/dev/cdrom /mnt/cdrom auto user,noauto,exec,ro 0 0
user
allows mounts and unmounts by users. Otherwise only
'root' is allowed to do that. Notice however, that this option will turn off
exec
. You have to specify exec
after the
user
option to allow execution of programs on user-mountable
drives, like it is done in this example. noauto
means that the
system shouldn't to mount the device at boot time, which is quite a sensible
option for removable media ;-). ro
specifies the media as
'read-only'. 'dump' and 'fsck' are disabled.
Although the CD isn't mounted automatically, the entry in '/etc/fstab' makes mounting much easier: Insert a CD into the drive and type
mount /mnt/cdrom
'mount' looks into '/etc/fstab' for an entry connected with this mount
point and takes the options which are listed there, so you don't have to
supply them anymore. In KDE, you just have to insert the CD and click on the
CD icon. This will issue the correct 'mount' command automatically.
A mounted CD will lock the CD tray. To change or eject the CD, you have to
unmount it first with umount /mnt/cdrom
.
To configure additional removable media, you have to know the name of their device files. Either check devices.txt or read the article on removable storage devices.
Now what would an entry for an MS-Windows partition look like? Assume it is the second partition on your first IDE drive and you want to have it mounted automatically. It's
/dev/hda2 /mnt/win_d vfat umask=0,quiet 0 0
The 'umask' option turns off the permissions check. Without that option, only 'root' can access files on this device. 'quiet' turns off those annoying and pointless error messages about not being able to set permissions when moving files to this medium.
If the file names on the Windows medium look funny, you might have to
specify two more options, 'iocharset' and 'codepage'. By default, 'mount' uses
the 'iso8859-1' charset and codepage 437. These enable character conversion.
Available charsets are listed in man charsets, setting the codepage
to 850 (codepage=850
) should fix most problems.
NFS and SMB shares can also be configured via 'fstab'. Please read the articles on Samba and NFS first, since options here are important and require some understanding on how these protocols work.
The basic syntax is not very different from that for local media. The entry for the 'device file' is just replaced by an entry for the remote server and share:
remote_server:share local_mount_point file_system
options dump fsck
So, an entry for automatically read-write mounting an NFS share called '/share/nfs' from the server 'domain.com' to the local '/mnt/nfs' directory would basically look like this:
domain.com:/share/nfs /mnt/nfs nfs rw 0 0
For SMB shares, you'd basically just replace the 'nfs' file system type with 'smbfs'.
If you are using 8.1, read this hint on 'supermount'.
'supermount' has been introduced in Mandrake Linux to make the handling of removable media much easier. It uses a nifty trick to automatically mount all inserted media: it mounts the (empty) devices by itself on boot and queries them regularly for newly inserted or removed media. The effect of which is that you don't have to mount or unmount external devices anymore: the system does it all by itself.
There just four instances left you have to worry about mounting: when adding a new device you want 'supermount' to handle, when you have to use a medium unmounted, when you use media with different file systems in the same device, or when you want to pass options to the 'mount' command via a 'supermount' entry.
# supermount -i enable
enables 'supermount' on all removable devices listed in '/etc/fstab'. In order to have this take effect, you have to reboot. This command requires 'root' privileges.
If the system doesn't recognize your new external device and thus doesn't write an entry to '/etc/fstab', you'll have to do that by yourself, either by creating a standard fstab entry for that device and then running the 'supermount' command to enable it, or by writing an entry in the 'supermount' format right away.
A common 'supermount' entry for a CD drive looks like this:
/mnt/cdrom /mnt/cdrom supermount fs=iso9660,dev=/dev/cdrom 0 0
mount_point mount_point supermount fs=file_system,dev=device 0 0
All you need to know for adding a new device is: the mount point (create one yourself as 'root' with mkdir /mnt/name), the file system the inserted medium will have (read man mount for supported types and their codes) and the device name (Either check devices.txt or read the article on removable storage devices).
One tricky thing here can be finding out how the vendor formatted the medium. Usually, they do not use the first partition, but either the forth (like Iomega's ZIP) or the fifth (like Castlewood's ORB). Remember to keep this scheme if you reformat the medium for Windows / Mac compatibility.
Certain tasks like playing music CDs for example require the medium to be inserted but unmounted. There's currently no other solution then to unmount the device, thus making it possible to use the unmounted medium but also turning off 'supermount' for the remaining session.
That entry in '/etc/fstab' however will only work with media that are formatted with the MS-Windows file system (vfat). It will not mount media formatted with GNU/Linux' extfs2, for example. You can change this easily, though, by simply setting the entry for the file system type to 'auto'. Make sure that '/etc/filesystems' contains entries for all the file systems you use.
'supermount' will now look up this file when inserting a medium and mount it with the appropriate parameters.
If you need or want to pass options to the 'mount' command when the device
is handled by 'supermount', you will need to separate these options from those
passed to 'supermount' itself with --,
Let's say you want to add the 'umask=0' option to a 'supermount' entry in '/etc/fstab':
/mnt/zip /mnt/zip supermount fs=vfat,dev=/dev/sda4,--,umask=0 0 0
would be the right way to do it.
This is not an error, it's a feature ;-). After a specified number of reboots Linux checks the file system for consistency even if the box has been shutdown properly. This can take some time, especially on large partitions. You can set the interval with 'tune2fs'.
You either haven't run 'shutdown' before turning the machine off or were
forced to reboot the machine because of a system freeze. The Linux file system
is very robust and usually you'll get away with a long file system check. If
you are unlucky, however, vital system files may have been damaged. Keeping
'/' on a small partition of its own minimizes this risk.
Mandrake Linux 8 and later offer you a variety of 'journalizing' file systems
to replace extfs2. Journaling file systems keep track (a 'journal') of all
read / write operations. So even in case of abrupt system failure, the status
of the system will be preserved and no checks will be run at reboot.
You have tried to mount a device that is not listed in '/etc/fstab' as being mountable by users (option 'user'). Do it as root. If you need to mount the device more often, it may be a good idea to change '/etc/fstab' accordingly.
The CD-Rom is still mounted. Unmount it and you'll be able to open the tray again. By the way, if you want to unmount a CD and have it ejected right away, use the 'eject' command ('eject' RPM): eject /dev/cdrom. This works for all kind of removable media.
The 'supermount' mechanism prevents 'df' from showing external media. To see them you have to supply the mount point as a parameter to 'df':
$ df /mnt/cdrom
File system Size Used Avail Use% Mounted on
- 641M 641M 0 100% /mnt/cdrom
You have tried to mount a partition or device by supplying only its mount directory. This only works for mount points listed in '/etc/fstab'. Either add it there or use the full mount line, like mount /dev/device /mnt/mount_directory.
Either this means you have provided the wrong options to 'mount' on the
command line or in '/etc/fstab', or the media hasn't been inserted or isn't
formatted properly. This can also happen if the CD features an ISO9660
extension which isn't supported by your CD drive (CD Text, for example).
This message refers to the so-called major and minor numbers of devices listed
in '/dev'. For example:
$ ls -l /dev/sda
brw-rw---- 1 root disk 8, 0 [etc]
'8' is the major number of 'sda' and '0' its minor number (so 'sdb' has 8,1). Linux handles devices by these numbers, not by their names. A list of valid names can be found in 'devices.txt' in the kernel's documentation directory. Usually you don't have to create new device nodes in /dev. If you do, and you get this error afterward, check if you've chosen the correct major and minor number for this device.
Audio CDs mustn't be mounted if you want to play them. If you mount them, Linux regards them as data CDs. This can lead to problems when 'supermount' is enabled. The solution is to unmount the CD (umount /mnt/cdrom) and to remount it when you want to insert a data CD. Unmounting a 'supermounted' device will disable 'supermount' for this device during the rest of the session. Or, having two CD-R drives, to disable 'supermount' on one of them at all.
This error occurs when you try to access a medium which hasn't been mounted - or, in case of supermount, inserted - yet, but might also be caused by a media failure or - with 'supermount' - by a software error.
This annoying error is either due to you still being inside a directory on a medium you try to unmount (eg in an xterm) or due to some rampant or misguided process which refuses to have its contents flushed and written to the drive. Wrongly configured or malfunctioning sound daemons are justly infamous for this kind of behavior. To find out, try to unmount the partition (do this on the console, not in X) and then run (as 'root')
# lsof /dev/device
where device is the system name of the partition which doesn't unmount properly (use df to find out). It should now show you the process(es) which are still have open files on the partition despite the unmount command.
As ML user Michael Javis knows, the reasons for this error may sometimes not be that obvious:
"I had reinstalled some RPMs from my Mandrake 7.2 CDs, and after installing I was unable to unmount the CDROM drive. Every time I would try to unmount /mnt/cdrom I would get a "device busy" error, even though I had no obvious files open on the device (such as viewing a README file with 'less' for example).
"If you are installing an RPM, directly from the CDROM, that affects the Apache web server (such as some of the PHP RPMs)...the RPM post-install script will do a restart of your web server. If your current working directory is on the /mnt/cdrom file system then the Apache web server will have open files on the device, preventing you from unmounting the CDROM.
"I changed to my home directory and restarted my web server and was finally able to unmount /mnt/cdrom."
To allow users read access to files on a mounted Windows partition (FAT, FAT32 or NTFS), you have to add the 'mount' option
umask=0
to the according entry in '/etc/fstab' and then remount the partition. Without this option, only 'root' can access files on such partitions.
Generally, you can run into two sorts of trouble when mounting removable media with different file systems on them to the same mount point.
Different partition setup.. Due the different handling of
partitions in Unix, Windows and Mac OS, FAT-pre formatted removable media
usually use either the fourth or the fifth partition to store data, but not
the first. If you reformat these media using the Linux ext2 file system,
however, the first partition will become the main data partition, thus
rendering the according entry in '/etc/fstab' invalid for this medium.
You will either need to create a different entry for this medium in
'/etc/fstab', or take care of formatting the medium according to its original
partition layout. Best bet is to not reformat the medium at all.
File system specific mount options. 'mount' offers you the
possibility to specify auto
as the file system type. This option
tells 'mount' to try all file systems listed in '/etc/filesystems' on any
medium to be mounted. This mechanism however works only as long as no file
system specific mount options (like umask
or
codepage
) are provided. If such options are provided, mounting
media with file systems which do not support these options will inevitably
fail (bad option).
Either remove these options or create a separate fstab entry.
Although this list of possible errors may sound disconcerting, mounting usually just works. But it can be annoying, if it doesn't ;-).
'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.
Disable 'supermount' by running (as 'root') supermount -i disable
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.
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
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.