Difference between revisions of "Fstab"

From Christoph's Personal Wiki
Jump to: navigation, search
 
(External links)
 
Line 102: Line 102:
 
*[http://www.ubuntuforums.org/showthread.php?t=283131 Understanding fstab]
 
*[http://www.ubuntuforums.org/showthread.php?t=283131 Understanding fstab]
 
*[http://wiki.linuxquestions.org/wiki/Fstab LinuxQuestions.org > Linux Wiki > Fstab]
 
*[http://wiki.linuxquestions.org/wiki/Fstab LinuxQuestions.org > Linux Wiki > Fstab]
 +
*[http://www.informatik.uni-freiburg.de/~mader/FSTAB-Tuning.html FSTAB-Tuning]
  
 
[[Category:Linux Command Line Tools]]
 
[[Category:Linux Command Line Tools]]

Latest revision as of 01:45, 3 April 2007

The correct title of this article is fstab. The initial letter is capitalized due to technical restrictions.

The fstab (for file systems table) file is part of the system configuration. The fstab file typically lists all used disks and disk partitions, and indicates how they are to be used or otherwise integrated into the overall system's file system.

Syntax

[Device] [Mount Point] [File_system] [Options] [dump] [fsck order]

Listing devices

To list your devices, first connect your USB device (it does not need to be mounted).

  • By volume label:
ls /dev/disk/by-label -lah
  • By id:
ls /dev/disk/by-id -lah
  • By uuid:
ls /dev/disk/by-uuid -lah

Example

The following is an example of a fstab file on a Red Hat Linux system:

# device name mount point fs-type options dump-freq pass-num
LABEL=/                 /                       ext3    defaults        1 1
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /proc                   proc    defaults        0 0
none                    /dev/shm                tmpfs   defaults        0 0

# my removable media
/dev/cdrom              /mnt/cdrom              udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/fd0                /mnt/floppy             auto    noauto,owner,kudzu 0 0

# my NTFS Windows XP partition
/dev/hda1               /mnt/WinXP              ntfs    ro,defaults     0 0

/dev/hda6               swap                    swap    defaults        0 0

# my files partition shared by windows and linux
/dev/hda7               /mnt/shared             vfat    umask=000       0 0

(kudzu is an option specific to Red Hat and Fedora Core)

  1. The first column indicates the device name or other means of locating the partition or data source.
  2. The second column indicates where the data is to be attached to the filesystem.
  3. The third column indicates the filesystem type, or algorithm to use to interpret the filesystem.
  4. The fourth column gives options, including if the filesystem should be mounted at boot.
  5. The fifth column adjusts the archiving schedule for the partition (used by dump).
  6. The sixth column indicates the order in which the fsck utility will scan the partitions for errors when the computer powers on.

A value of zero in either of the last 2 columns disables the corresponding feature (http://www.humbug.org.au/talks/fstab/fstab_structure.html).

To get more information about the fstab file you can read the man page about it.

The Kfstab graphical configuration utility is available for KDE for editing fstab.

Options common to all filesystems

As the filesystems in /etc/fstab will eventually be mounted using mount(8) it isn't surprising that the options field simply contains a comma-separated list of options which will be passed directly to mount when it tries to mount the filesystem.

The options common to all filesystems are:

sync / async 
All I/O to the file system should be done (a)synchronously.
auto 
The filesystem can be mounted automatically (at bootup, or when mount is passed the -a option). This is really unnecessary as this is the default action of mount -a anyway.
noauto 
The filesystem will NOT be automatically mounted at startup, or when mount passed -a. You must explicitly mount the filesystem.
exec / noexec 
Permit/Prevent the execution of binaries from the filesystem.
suid / nosuid 
Permit/Block the operation of suid, and sgid bits.
ro 
Mount read-only.
rw 
Mount read-write.
user 
Permit any user to mount the filesystem. This automatically implies noexec, nosuid,nodev unless overridden.
nouser 
Only permit root to mount the filesystem. This is also a default setting.
defaults 
Use default settings. Equivalent to rw,suid,dev,exec,auto,nouser,async.

There are numerous options for the specific filesystems supported by mount. However these are some of the more useful, for the full list check out the man page for `mount`.

ext2

check={none, normal, strict} 
Sets the fsck checking level.
debug 
print debugging info on each remount.
sb=n 
n is the block which should be used as the superblock for the fs.

fat

check={r[elaxed], n[ormal], s[trict]} 
Not the same as ext2, but rather deals with allowed filenames. See mount(8).
conv={b[inary], t[ext], a[uto]} 
Performs DOS<->UNIX text file conversions automatically. See mount(8).
uid=n, gid=n 
Set the user identifier, uid, and group identifier, gid, for all files on the filesystem.

iso9660

norock 
Disables Rock Ridge extensions.

Reloading fstab

This command will reload fstab without a restart of the system:

mount -a

See also

External links