The file /etc/fstab explained


In the file /etc/fstab you keep all devices (Hard discs, cdrom/dvd drives, etc.) that may be mounted on your system.

An example:

# Root file system 
/dev/hda1    /            ext2         defaults       1   1 
# The directory /var gets its own partition
/dev/hdb2    /var         ext2         defaults       1   2
# The swap partition
/dev/hda3    swap         swap         defaults       0   0
# ATAPI Cdrom and Floppy drive
/dev/hdc     /cdrom       iso9660      ro,noauto,user 0   0
/dev/fd0     /floppy      auto         noauto,user    0   0
# The process file system
proc         /proc        proc         defaults       0   0

The lines are divided into the following elements:

  1. the device you want to mount
  2. the path to the directory, where you want to mount it (mount point)
  3. the file system
  4. the options, with which you want to mount your drive (for example user rights)
  5. Dump is just relevant for the old ext2 file system.
  6. Check is important for file system checks on boot. For your root file system there should be a "1", for all the others either "0" (no check at all) or "2". File systems with the same number are checked in parallel. So the root file system should have a different number than the others.

The available options for 4):

  • defaults for default settings (rw, suid, auto, nouser…)
  • noauto if the device shall not automatically be mounted at boot
  • user if the device may be mounted by a normal user
  • ro, rw if you want to mount your device read only or with write permissions
  • exec if you want to permit execution of binary files
  • sync if you want unbuffered writing