Sunday, January 10, 2010

Partition / Filesystem Mount Options - fstab file

Here is a sample /etc/fstab entry
/dev/cdrom /media/cdrom auto ro,noauto,user,exec 0 0

The fourth column in fstab lists all the mount options for the device or partition. This is also the most confusing column in the fstab file, but knowing what some of the most common options mean, saves you from a big headache. For more information, check out the man page of mount.

auto and noauto With the auto option, the device will be mounted automatically (at bootup). auto is the default option. If you don't want the device to be mounted automatically, use the noauto option in /etc/fstab. With noauto, the device can be mounted only explicitly.

user and nouser These are very useful options. The user option allows normal users to mount the device, whereas nouser lets only the root to mount the device. nouser is the default. If you're not able to mount your cdrom, floppy, Windows partition, or something else as a normal user, add the user option into /etc/fstab.

exec and noexec exec lets you execute binaries that are on that partition, whereas noexec doesn't let you do that. noexec might be useful for a partition that contains binaries you don't want to execute on your system, or that can't even be executed on your system. This might be the case of a Windows partition.

ro Mount the filesystem read-only.

rw Mount the filesystem read-write.

sync and async sync means it's done synchronously, this means that when you, for example, copy a file to the partition, the changes are physically written to the partition at the same time you issue the copy command.

However, if you have the async option in /etc/fstab, input and output is done asynchronously. Now when you copy a file to the partition, the changes may be physically written to it long time after issuing the command. async is default.

defaults Uses the default options that are rw, suid, dev, exec, auto, nouser, and async. Source: