Mounting Devices
Strong-mounting devices before their contents or services be accessed
Devices have to be mounted before their contents or services may be accessed. Mounting a device is practically the same as mounting a filesystem - Linux treats all devices like files. The file system corresponding to the device (usually /dev/<driver_name>) should be unmounted after use through the 'umount' command.
The simplest way to mount a device is to use the following command:
mount <device_name> <mount_point>: # mount /dev/hdc /mnt/cdrom
The above command mounts the device at /dev/hdc and makes its contents appear in the directory /mnt/cdrom. The mount command may only be used by the superuser. The most common type of hard drives and CDROMs in PCs are IDE drives. These drives require a controller, a Master, and a Slave. Each IDE device under Linux has a fixed device name.
| Device Name | IDE Controller | Drive Designation |
| /dev/hda | Primary | Master |
| /dev/hdb | Primary | Slave |
| /dev/hdc | Secondary | Master |
| /dev/hdd | Secondary | Slave |
CD-ROM drives typically correspond to a Secondary Master device (/dev/hdc). The file /etc/fstab (File System Table) may be used to store mount instructions and configuration for frequently mounted items. The following are some entries from a typical fstab file:
/dev/fd0 /mnt/floppy ext2 noauto,user,rw 0 0 /dev/cdrom /mnt/cdrom iso9660 noauto,user,rw 0 0
The first column lists the driver corresponding to the file system (device). The second column lists the position in the directory tree where the contents of the device will appear. This directory must already exist on the file system. The third column lists the type of file system on the device. The ext2 file system is the native file system for Linux. The file system type for CDROMs is always iso9660. The fourth column contains a comma-separated list (no spaces) of options to the mount command. The "noauto" option prevents Linux from trying to mount removable media at boot time. The 'user' option allows normal users to mount and unmount the media. Since users are only allowed read access by default, the 'rw' option is used to give all users write access. The fifth and sixth columns refer to media backups and fsck file checks while mounting; the latter should always be set to 0 for floppy drives and CDROM drives.