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.
- 1Linux Top 3: Alpine Linux 3.4, deepin 15.2 and Linux Lite 3.0
- 2Linux 4.7 Set to Boost Live Patching, Security and Power Management
- 3Linux 4.6 Charred Weasel adds USB 3.1 Support
- 4Linux Top 3: OpenIndiana 2016.04, Ubuntu 16.04 and Debian's New Leader
- 5Linux Top 3: KaOS 2016.04, TurnKey 14.1 and pfSense 2.3