The /etc/fstab file tells the system how and where to mount filesystems by default.
The syntax of the file is this:
FS_SPEC (DEVICE) - the device or remote filesystem to be mounted.
FS_FILE (MOUNT_POINT) - the mount point for the filesystem. NOTE: For swap partitions, this field should be specified as `none'. If the name of the mount point contains spaces these can be escaped as `\040'.
FS_VFSTYPE (FILESYSTEM)- the type of the filesystem. As of Slackware 10.2, the FILE_SYSTEM choices are:
- auto, adfs, affs, autofs, coda, cramfs, devpts, efs, ext2, ext3, hfs, hpfs, iso9660, jfs, minix, msdos, ncpfs, nfs, nfs4, ntfs, proc, qnx4, reiserfs, romfs, smbfs, sysv, tmpfs, udf, ufs, umsdos, vfat, xfs, xiafs and possibly others.
NOTE: for swap-able and portable devices (e.g. memory sticks and CDROMs),
auto is the best choice because it allows the computer to determine the correct filesystem.
FS_MNTOPS (OPTION) - the (comma seperated) mount options. See the MOUNT command's MAN PAGE for the options because there are MANY!
The most commonly used options are:
- noauto - do not mount this device/partition automatically on boot-up.
- ro - mount this device/partition READ-ONLY (e.g. CDROM).
- owner - Only allow the owner to mount and un-mount this device/partition.
- users - Allow any user to mount or unmount this device/partition.
FS_FREQ (DUMP) - used for these filesystems by the dump command to determine which filesystems need to be dumped. If the fifth field is not present, a value of zero is returned and dump will assume that the filesystem does not need to be dumped. For the most part, this should be "0" (zero).
FS_PASSNO (FSCK_ORDER) - used by the fsck program to determine the order in which filesystem checks are done at reboot time. The root filesystem should be specified with a fs_passno of 1, and other filesystems should have a fs_passno of 2. Filesystems within a drive will be checked sequentially, but filesystems on different drives will be checked at the same time to utilize parallelism available in the hardware. If the sixth field is not present or zero, a value of zero is returned and fsck will assume that the filesystem does not need to be checked.
Benefits Of fstab Entries
Once you have a device in the fstab, mounting become VERY easy. Instead of having to:
mount -t iso9660 /dev/hdb1 /mnt/cdrom
every time you want to use the CDROM, you can just type:
IF you have the entry in your fstab.
- /dev/hdc1 /mnt/cdrom auto noauto,ro,owner,users 0 0
- /dev/sda1 /mnt/memstick auto noauto,owner,users 0 0
(make sure to
mkdir /mnt/memstick after changing your /etc/fstab).