Mounting is the process of making a device accessible to users through the directory tree. The directory to which the device or partition is attached is called the mount point.
- Volumes are represented by files located in the /dev directory; however, volumes must be mounted before use.
- A volume is mounted to a directory. When accessing the directory in the file system, you are actually accessing the volume mounted to that directory.
- Always mount volumes and other storage devices to empty directories. Mounting a volume to a directory that contains data makes the data inaccessible.
- The /mnt and /media directories (depending on the system configuration) are directories that contain mount points specifically for external storage devices (e.g., CD-ROM drives, floppy drives, magnetic tape drives).
The following files manage and monitor the mounting of file systems:
|/etc/fstab||The /etc/fstab file identifies volumes to mount each time the system boots. When the system boots, it automatically mounts the volumes identified in the file. The file contains entries with six fields that control how a device is mounted. A common entry is shown below:
/dev/hda3 /mnt/disk1 ext3 auto,ro,nosuid,users 0 1
The fields in entry are as follows:
|/etc/mtab||The /etc/mtab file tracks the currently-mounted volumes on the system.|
|/procs/mounts||The /procs/mounts file contains entries for all currently-mounted volumes on the system. The /proc file system is a virtual file system that contains current system information, including the mounted file systems.|
Use the following commands to manage the mounting of file systems:
|mount /dev/device /mountpoint||Mount a volume or device. Common mount options:
||mount -a reads the /etc/fstab file and mounts all volumes listed (except those with the noauto parameter)
mount -rt reiserfs /dev/hdc1 /mnt/reis mounts the hdc1 device with the reiser file system as read only to the /mnt/reis mount point.
mount -t iso9660 /dev/cdrom /media/cdrom mounts the CD-ROM device to the /media/cdrom mount point.
mount -wt vfat /dev/fd0 /mnt/floppy mounts the fd0 device with the vfat file system as read/write to the floppy mount point.
|mount||View the currently-mounted volumes on the system. This will display the contents of the /etc/mtab file.|
|df||View which file systems are mounted to specific mount points.|
|Unmount a volume or device from the system. If disk is busy is displayed when unmounting a device:
||umount /dev/hdc1 unmounts the hdc1 device.
umount /mnt/reis unmounts the device on the /mnt/reis mount point.
umount /dev/cdrom unmounts the CD-ROM device.
umount /mnt/cdrom unmounts the device on the /mnt/cdrom mount point (most likely a CD-ROM device).