April 16, 2014

Controlling Your Linux System With fstab - page 2

Understanding fstab

  • April 21, 2010
  • By Akkana Peck
The next two fields are straightforward. The mount point is wherever you want to mount that filesystem: /, /home, /boot or wherever. It should be an empty directory that already exists. If it's not empty, whatever is inside will be hidden when you mount something on top of it.

The type is the filesystem type, like ext2, ext3, Windows filesystems vfat and ntfs, or iso9660 for CDs. You can also use auto, and Linux will try to guess the filesystem type. man filesystems has a list of supported filesystems.


The options field is the most complex. This is where you specify "everything else" -- anything that doesn't fit in the other fields. If you don't have any specific options, just use defaults.

You can list as many options as you want, separated by commas. For instance, a CDROM might use ro,user,noauto,exec, starting with ro for read-only.

user means it doesn't need root privileges to mount it: any user can type mount /media/cdrom0, if you don't have a service already mounting it for you.

noauto means the system won't try to mount it when the system boots -- a good idea for removable devices. It doesn't say anything about whether a process like hal may try to automount it later if you insert a CD -- that's controlled elsewhere.

exec tells the system to let you run programs from that file system. That's otherwise disabled on CDROMs and Windows filesystems.

On Windows FAT filesystems, if you use exec you may also want fmask=111: Windows filesystems don't have permissions, so you need to make sure the execute bit is set if you want to run programs.

Put these all together, and you can make an entry that's useful on systems that don't automatically mount USB devices:

/dev/sdb1       /stuff        vfat      user,noauto,exec,fmask=111 0 0

If your device shows up somewhere besides /dev/sdb1, adjust as needed. Then sudo mkdir /stuff, and whenever you plug in your camera, mp3 player or USB stick you'll be able to mount it by typing mount /stuff.

For a full list of options, see man mount and scroll down to FILESYSTEM INDEPENDENT MOUNT OPTIONS and FILESYSTEM SPECIFIC MOUNT OPTIONS.

dump and pass

Dump specifies how often you want the filesystem backed up. Most people don't use this field, but if you're running automated backup software you might want it

Pass indicates when and whether the device should be checked with fsck before being mounted. Generally you should use 1 for the root filesystem, 2 for all your other normally mounted filesystems, and 0 for filesystems that aren't mounted by default.

Akkana Peck is a freelance programmer and writer and author of the book Beginning GIMP: From Novice to Professional. She also spends way too much time fiddling with reconfiguring her Linux distros.

Sitemap | Contact Us