Controlling Your Linux System With fstab - page 2
Understanding fstabThe 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.
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.
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: CoreOS, Oracle Enterprise Linux 7 and Ubuntu 14.10
- 2Linux Top 3: Debian Dumps SPARC, Ubuntu Takes Over Linux 3.13 and the Core Infrastructure Initiative
- 3Linux Top 3: Fedora, Ubuntu and Gluster Lose Community Leaders
- 4Red Hat Enterprise Linux 7 Finally Hits the Big Time
- 5Linux Top 3: Tails 1.0, OpenMandriva Lx 2014.0 and Debian 7.5