The
fstab is a file in
Unix,
Linux and
BSD used to specify how to
mount filesystems. It resides in the
directory /etc. It is also used to tell the system to auto-mount a filesystem at startup. It can also be described as a
file
system
table, hence the name
fstab.
Mounting something means making it accessible to the user. For example; you cannot insert a CD in a CD-ROM and expect the system to automatically be able to read from it. You have to mount it first. Microsoft Windows does this automatically, along with other popular operating systems, but in Unix, Linux and similar systems, you have got to mount it first.
A basic
fstab might look like something similar:
/dev/hda1 / ext2 defaults 1 1
/dev/cdrom /mnt/cdrom iso9660 noauto,owner,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner 0 0
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
Now, lets have a look at the specific items. Lets use the first entry as an example.
-
The leftmost item is where the source for the mount can be found. In this case, /dev/hda1, it points to the first partition (the 1 in hda1) of the first (the a in hda1) IDE hard drive (the hd in hda1). This is where the source is read from.
-
Furthermore, parameter two. This is where the source is mounted. This means that the data from the source can be found at this point.
-
The third parameter specifies which filesystem to use when mounting. In this case, it is the native Linux file system, ext2.
-
By looking at the fourth parameter, we find out which options are passed when mounting. In this case, it uses only the default parameters.
-
The fifth and the sixth one are parameters used by dump(8) and fsck(8). Setting the fifth parameter to 0 means that dump will assume the file system does not need to be dumped. The sixth parameter should always be 1 on the root filesystem to ensure it is always checked first, and should be 2 on other file systems. This makes fsck periodically check the file systems. If set to 0, the file system is not checked.
Possible file system types are, in
Linux 2.4.18:
adfs, affs, autofs, coda, coherent, cramfs, devpts, efs, ext, ext2, ext3, hfs, hpfs, iso9660, jfs, minix, msdos, ncpfs, nfs, ntfs, proc, qnx4, reiserfs, romfs, smbfs, sysv, tmpfs, udf, ufs, umsdos, vfat, xenix, xfs and xiafs.
For more extensive information, see
http://www.freebsd.org/cgi/man.cgi?fstab.
Update: once again, thanks to toalight for correcting my grammatical errors :)