Fstab
Jump to navigation
Jump to search
In linux, fstab (aka, file systems table) is a configuration table designed to mount and unmount file systems to a machine.
The fstab file is read by the mount
command, which happens automatically at boot time to determine the overall file system structure, and thereafter when a user executes the mount
command to modify that structure
Fstab syntax
fstab is a 6 column structure, where each column designates a specific parameter and must be set up in the correct order. [1]
Column | Description |
---|---|
Device | usually the given name or UUID of the mounted device (sda1/sda2/etc). |
Mount Point | designates the directory where the device is/will be mounted |
File System Type | shows the type of filesystem in use |
Options | lists any active mount options. If using multiple options they must be separated by commas.
fs-type independant options
owner : Permit the owner of device to mount (Linux-specific)
fs-type dependent options
|
Backup Operation(the first digit) | this is a binary system, where
|
File System Check Order(second digit) | 0 - do not check
1 - check immediately during boot 2 - check after boot |
Example
# device-spec mount-point fs-type options Backup check-order
LABEL=/ / ext4 defaults 1 1
/dev/sda6 none swap defaults 0 0
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
# bind mount
/opt/backups /srv/nfs4/backups none bind 0 0
/var/www /srv/nfs4/www none bind 0 0
#SSHFS mount
user@host:/remote/dir /local/mountpoint fuse.sshfs defaults 0 0
#NFS mount
192.168.33.10:/backups /backups nfs defaults,timeo=900,retrans=5,_netdev 0 0
192.168.33.10:/www /srv/www nfs defaults,timeo=900,retrans=5,_netdev 0 0
# Removable media
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,ro 0 0
# NTFS Windows 7 partition
/dev/sda1 /mnt/Windows ntfs-3g quiet,defaults,locale=en_US.utf8,umask=0,noexec 0 0
# Partition shared by Windows and Linux
/dev/sda7 /mnt/shared vfat umask=000 0 0
# Mounting tmpfs
tmpfs /mnt/tmpfschk tmpfs size=100m 0 0
# Mounting cifs
//cifs_server_name/ashare /store/pingu cifs credentials=/root/smbpass.txt 0 0
# Mounting NFS
nfs_server_name:/store /store nfs rw 0 0