How To Wiki
Advertisement
Difficulty med
About:Ratings

Fstab is a file for storing mount points and settings for hard drives, cd DVD, floppy and other block devices

Configuration File=

  • /etc/fstab

Format[]

Each line is the configuration for each device. On one line there is 6 fields

  • device
  • Ex: /dev/hdc1
  • Mount point
    • Ex: /mnt/otherDrive
  • Filesystem
    • ext3
  • Options
    • Ex: defaults
  • Dump
    • Ex: 0
  • fsck
    • Ex: 1
  • [device] [mount point] [filesystem] [mount options] [dump] [fsck]

Device[]

The block device you want to mount

Common devices

  • CDROM: /dev/cdrom
  • Primary IDE harddrive, partition 1: /dev/hda1
  • Secondary IDE harddrive, partition 4: /dev/hdb4
  • Primary SCSI harddrive, partition 1: /dev/sda1
  • floppy disk: /dev/fd0

Mount Point[]

This is entirely decided by you.

  • Needed
    • Root: /
  • Optional
    • /mnt/cdrom
    • /mnt/extradrive

File System[]

Common Linux file systems

  • ext2
  • ext3
  • reiserfs
  • swap

Microsoft

  • fat32: vfat
  • DOS: msdos

All supported types:

  • adfs, affs, autofs, coda, coherent, cramfs, debugfs, devpts, efs, ext, ext2, ext3, hfs, hpfs, iso9660, jfs, minix, msdos, ncpfs, nfs, nfs4, ntfs, proc, qnx4, ramfs, reiserfs, romfs, smbfs, sysv, tmpfs, udf, ufs, umsdos, usbfs, vfat, xenix, xfs, xiafs

Options[]

  • async
    All I/O to the file system should be done asynchronously.
  • atime
    Update inode access time for each access. This is the default.
  • auto
    Can be mounted with the -a option.
  • defaults
    Use default options: rw, suid, dev, exec, auto, nouser, and async.
  • dev
    Interpret character or block special devices on the file system.
  • exec
    Permit execution of binaries.
  • group
    Allow an ordinary (i.e., non-root) user to mount the file system if one of his groups matches the group of the device. This option implies the options nosuid and nodev (unless overridden by subsequent options, as in the option line group,dev,suid).
  • mand
    Allow mandatory locks on this filesystem. See fcntl(2).
  • _netdev
    The filesystem resides on a device that requires network access (used to prevent the system from attempting to mount these filesystems until the network has been enabled on the system).
  • noatime
    Do not update inode access times on this file system (e.g., for faster access on the news spool to speed up news servers).
  • nodiratime
    Do not update directory inode access times on this filesystem.
  • noauto
    Can only be mounted explicitly (i.e., the -a option will not cause the file system to be mounted).
  • nodev
    Do not interpret character or block special devices on the file system.
  • noexec
    Do not allow direct execution of any binaries on the mounted file system. (Until recently it was possible to run binaries anyway using a command like /lib/ld*.so /mnt/binary. This trick fails since Linux 2.4.25 / 2.6.0.)
  • nomand
    Do not allow mandatory locks on this filesystem.
  • nosuid
    Do not allow set-user-identifier or set-group-identifier bits to take effect. (This seems safe, but is in fact rather unsafe if you have suidperl(1) installed.)
  • nouser
    Forbid an ordinary (i.e., non-root) user to mount the file system. This is the default.
  • owner
    Allow an ordinary (i.e., non-root) user to mount the file system if he is the owner of the device. This option implies the options nosuid and nodev (unless overridden by subsequent options, as in the option line owner,dev,suid).
  • remount
    Attempt to remount an already-mounted file system. This is commonly used to change the mount flags for a file system, especially to make a readonly file system writeable. It does not change device or mount point.
  • ro
    Mount the file system read-only.
  • rw
    Mount the file system read-write.
  • suid
    Allow set-user-identifier or set-group-identifier bits to take effect.
  • sync
    All I/O to the file system should be done synchronously. In case of media with limited number of write cycles (e.g. some flash drives) "sync" may cause life-cycle shortening.
  • dirsync
    All directory updates within the file system should be done synchronously. This affects the following system calls: creat, link, unlink, symlink, mkdir, rmdir, mknod and rename.
  • user
    Allow an ordinary user to mount the file system. The name of the mounting user is written to mtab so that he can unmount the file system again. This option implies the options noexec, nosuid, and nodev (unless overridden by subsequent options, as in the option line user,exec,dev,suid).
  • users
    Allow every user to mount and unmount the file system. This option implies the options noexec, nosuid, and nodev (unless overridden by subsequent options, as in the option line users,exec,dev,suid).

context=context, fscontext=context and *defcontext=context\

  • See: man mount

Dump[]

0 or 1 denotes if the partition needs to be dumped, in general, leave it "0"

Fsck[]

Denotes whether the filesystem should be checked if it was not shut down properly

  • Don't check: 0
  • 1, or 2
  • root should be: 1


Examples[]

  • Hard drive
    /dev/hda1 /mnt/windows vfat uid=500,gid=500,rw 0 0
  • Sambamount
    //monkey/Movies /mnt/abbas smbfs username=taco,password=paco


Sources[]

From HowTo Wiki, a Wikia wiki.

Advertisement