Fstab options explained
/etc/fstab is a configuration file that mount can use. This file contains a list of all partitions known to the system. During the boot process, this list is read and the items in it are automatically mounted with the options specified therein.
Here’s the format of entries in the /etc/fstab file:
/dev/device /dir/to/mount fstype Parameters fs_freq fs_passno
Following is a sample /etc/fstab file:
1) /dev/VolGroup00/LogVol00 / ext3 defaults 1 1 2) LABEL=/boot /boot ext3 defaults 1 2 3) devpts /dev/pts Devpts gid=5,mode=620 0 0 4) tmpfs /dev/shm tmpfs defaults 0 0 5) /dev/VolGroup00/LogVol02 /home ext3 defaults 1 2 6) proc /proc proc defaults 0 0 7) sysfs /sys sysfs defaults 0 0 8) /dev/VolGroup00/LogVol03 /tmp ext3 defaults 1 2 9) /dev/VolGroup00/LogVol01 swap swap defaults 0 0 10) /dev/sr0 /media/cdrom auto user,noauto,exec 0 0
Line 1 The first entry in our sample /etc/fstab file is the entry for the root volume. The first column shows the device that houses the file system, i.e., the /dev/VolGroup00/LogVol00 logical volume (more on volumes later on). The second column shows the mount point, i.e., the “/” directory. The third column shows the file system type, i.e., ext3 in this case. The fourth column shows the options with which the file system should be mounted—only the default options are required in this case. The fifth field is used by the dump utility (a simple backup tool) to determine which file systems need to be backed up. And the sixth and final field is used by the fsck program to determine if the file system needs to be checked and also to determine the order in which the checks are done.
Line 2 The next entry in our sample file is the /boot mount point. The first field of this entry shows the device—in this case, it points to any device with the /boot label. The other fields mean basically the same thing as the field for the root mount point discussed previously. In the case of the /boot mount point, you might notice that the field for the device looks a little different from the usual /dev/<path-to-device> convention. The use of labels helps to hide the actual device (partition) that the file system is being mounted from. The device has been replaced with a token that looks like the following: LABEL=/boot. During the initial installation, the partitioning program of the installer automatically set the label on the partition. Upon bootup, the system scans the partition tables and looks for these labels. This is especially useful when Small Computer System Interface (SCSI) disks are being used. Typically, SCSI has a set SCSI ID. Using labels allows you to move the disk around and change the SCSI ID, and the system will still know how to mount the file system even though the device might have changed, for example,from /dev/sda10 to /dev/sdb10
Line 4 Next comes the tmpfs file system, also known as a virtual memory (VM) file system. It uses both the system random access memory (RAM) and swap area. It is not a typical block device because it does not exist on top of an underlying block device; it sits directly on top of VM. It is used to request pages from the VM subsystem to store files. The first field—tmpfs—shows that this entry deals with a VM and, as such, is not associated with any regular UNIX/Linux device file. The second entry shows the mount point, /dev/shm. The third field shows the file system type, i.e., tmpfs. The fourth field shows that this file system should be mounted with the default options. The fifth and sixth fields have the same meanings as the ones for the previous entries discussed. Note especially that the values are zero in this case, which makes perfect sense, because there is no reason to run a dump on a temporary file system at bootup and there is also no reason to run fsck on it, since it does not contain an ext2/3-type file system.
Line 6 The next notable entry is for the proc-type file system. Information concerning the system processes (hence the abbreviation proc) are dynamically maintained in this file system. The proc in the first field of the proc entry in the /etc/fstab file has the same implication as that of the tmpfs file system entry. The proc file system is a special file system that provides an interface to kernel parameters through what looks like any other file system; that is, it provides an almost human-readable look to the kernel. Although it appears to exist on disk, it really doesn’t—all the files represent something that is in the kernel. Most notable is /dev/kcore, which is the system memory abstracted as a file. People new to the proc file system often mistake this for a large, unnecessary file and accidentally remove it, which will cause the system to malfunction in many glorious ways. Unless you are sure you know what you are doing, it’s a safe bet to leave all the files in the /proc directory alone
Line 7 Next comes the entry for the sysfs file system. This is new and necessary in the Linux 2.6 kernels. Again, it is temporary and special, just like the tmpfs and proc file systems. It serves as an in-memory repository for system and device status information. It provides a structured view of a system’s device tree. This is akin to viewing the devices in Windows Device Manager as a series of files and directories instead of through Control Panel view.
Line 8 The next entry is for the /tmp mount point. This refers to an actual physical entity or device on the system. just like the root (“/”) mount point and the /boot mount point.
Line 9 This is the entry for the system swap partition. It is where virtual memory resides. In Linux, the virtual memory can be kept on a separate partition from the root partition. (It should be noted that a regular file can also be used for swap purposes in Linux.) Keeping the swap space on a separate partition helps to improve performance, since the swap partition can obey rules differently from a normal file system. Also, since the partition doesn’t need to be backed up or checked with fsck at boot time, the last two parameters on it are zeroed out. (Note that a swap partition can be kept in a normal disk file as well. See the man page on mkswap for additional information.)
Line 10 The last entry in the fstab file that is worthy of mentioning is the entry for the removable media. In this example, the device field points to the device file that represents the CD-ROM device. The CD-ROM drive here is the master of the secondary Integrated Drive Electronics (IDE) controller (/dev/hdc). The mount point is /media/cdrom, and so when a CD-ROM is inserted and mounted on the system, the contents of the CD can be accessed from the /media/cdrom directory. The auto in the third field means that the system will automatically try to probe/detect the correct file system type for the device. For CD-ROMs, this is usually the iso9660 or the Universal Disk Format (UDF) file system. The fourth field lists the mount options.
Note: When mounting partitions with the /etc/fstab file configured, you can run the mount command with only one parameter: the directory you wish to mount to. The mount command checks /etc/fstab for that directory; if found, mount will use all parameters that have already been established there. For example, here’s the short command to mount a CD-ROM given the /etc/fstab file shown earlier:
[root@fedora-serverA ~]# mount /media/cdrom/
In case of any ©Copyright or missing credits issue please check CopyRights page for faster resolutions.