Fstab

From wikinotes

The fstab stores mounts/mount-options, optionally running them at system startup.


Example

# src    # dst  # filesystem  # mount-opts  # dump  # fsck

UUID=2324181d-2a92-43cd-9f11-3f42492fff43 \
  /           \ 
  ext4        \
  rw,relatime \
  0 1

UUID=2C50-FA59 \
  /boot        \
  vfat         \ 
  rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro \
  0 2

/dev/sda2   \
  /mnt/disk \
  ext4      \
  defaults  \
  0 1

//10.10.10.10/movies  \
  /mnt/movies         \
  cifs                \
  auto,_netdev,users,username=smbusername,password=yourpassword,workgroup=WORKGROUP,dir_mode=0777,file_mode=0664,gid=smbshare,x-systemd.automount,vers=3.0 \
  0 0

Components

NOTE:

the man page is very succinct, and helpful. divided numerically into components

# src    # dst  # filesystem  # mount-opts  # dump  # fsck
/source  /dest  ext4          defaults      0       2
  • The first 3x entries are fairly self explanatory. See the manpage for edge cases.

mount options

There are a few globally available mount-options, and filesystems may also have their own mount options.

Notable entries:

defaults:   rw,suid,dev,exec,auto,nouser,async
noauto:     do not mount at boot-time (or when `mount -a` is invoked)

dump

dump is a command that can be used to backup filesystems. Most modern linuxes do not use it, BSD systems generally do still use it.

0  # do not include in dump
1  # include in dump

fsck

fsck validates your filesystem before mounting it.

0  # do not check with fsck
1  # do check fsck, is your OS partition
2  # do check fsck, not OS partition