/etc/fstab Explained

The /etc/fstab file is one of the most important files on any Linux system. It keeps track of disk devices and their mount points on the UNIX directory tree.

Devices kept track with this file are the partition(s) where Linux is installed, the swap partition, any partitions created by other operating systems, floppy drive devices, zip drives, digital cameras, card readers, and other devices that are treated as disks by Linux.

fstab stands for File System Table, and it is used by the mount, umount, and eject commands, and any other software that has that functionality.

SimplyMEPIS treats the /etc/fstab slightly different from other Linux distributions. /etc/fstab is divided into two parts, one for static mounting as with other Linux distributions, the other edited by the udev and hal subsystems (the dynamic portion).

Definitions: udev and hal are subsystems for creating and removing devices that are plugged into your system at runtime. hal stands for Hardware Abstraction Layer.

The following is a sample /etc/fstab from a SimplyMEPIS installation:

# Pluggable devices are handled by uDev, they are not in fstab
/dev/hda5 / ext3 defaults,noatime 1 1
/dev/ipod /media/ipod vfat noauto,users,noexec,rw 0 0
none /proc proc defaults 0 0
none /proc/bus/usb usbfs devmode=0666 0 0
none /dev/pts devpts mode=0622 0 0
none /sys sysfs defaults 0 0
# Dynamic entries below, identified by 'users' option
/dev/hda1 /mnt/hda1 ntfs noauto,users,exec,ro,umask=0222 0 0
/dev/hda6 swap swap sw,pri=1 0 0
/dev/cdrom /media/cdrom iso9660,udf noauto,users,exec,ro 0 0
/dev/fd0 /media/floppy vfat,ext2 noauto,users,exec,rw 0 0

The line containing Dynamic entries below is the division point between the static and dynamic portion of the file.

You can edit the portion above this line as I did with the line containing /dev/ipod, used for mounting and ejecting of my iPod.

However, you cannot edit lines below the division point. These lines are dynamically edited each time your SimplyMEPIS machine boots to reflect the current state of the hardware in terms of disk storage.

The Lines

Each line in /etc/fstab represents a mapping of a physical device or partition to a mount point in the UNIX filesystem.

Let us take an example, the line representing my iPod:

/dev/ipod /media/ipod vfat noauto,users,noexec,rw 0 0

There are six fields that make up this /etc/fstab line, with at least one space separating each field.

Device name This is the UNIX filename representing the physical device or partition. Typically, this name starts with /dev.
Mount point This is the UNIX filename on the directory structure where the device or partition is to be mounted.
File system type This field represents the filesystem to be used when mounting the device or partition. Typical values for this field are ext2, ext3, reiserfs, vfat, iso9660, and udf. auto can be used if multiple filesystems can be used on removable devices such as card readers, CD-ROMs, and DVD-ROMs.
Options These are options given to the mount, umount and eject commands. A value of defaults means to use the default options for the filesystem being used. users means that any user can mount the device. owner means that only the owner of the device can mount and unmount the device. Usually this is the administrator. rw means to mount the device for read and write access. ro means the device is mounted for read-only access. There are quite a few other options that can be placed in this field.
dump This is usually set to zero for removable devices.
needs checked When set to zero, this tells Linux not to do a filesystem integrity check on this device at boot time. Setting this value to anything other than zero means the filesystems for the device will be integrity checked at each boot time. This is not recommended for removable devices.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License