Translation(s): English - Español - Français - Italiano - Português (Brasil) - Русский


The fstab (/etc/fstab) (or file systems table) file is a system configuration file on Debian systems. The fstab file typically lists all available disks and disk partitions, and indicates how they are to be initialized or otherwise integrated into the overall system's file system.

Example

# <file system>        <dir>         <type>    <options>             <dump> <pass>
/dev/sda1              /             ext4      defaults              1      1
/dev/hdxx              /usr          ext4      defaults              1      1
/dev/sda5              swap          swap      defaults              0      0

It is not necessary to list /proc and /sys in the fstab unless some special options are needed. The boot system will always mount them.

Field definitions

/etc/fstab contains the following fields separated by a space or tab:

<file system>   <dir>   <type>  <options>       <dump>  <pass>

Defining filesystems

You can define the filesystems in the /etc/fstab configuration in three different ways: by kernel naming descriptors, by UUID, or by labels. The advantage of using UUIDs or labels is that they are not dependent on disk order. This is useful if you change your storage device order in the BIOS, you switch storage device cabling, or because some BIOS's may occasionally change the order of storage devices.

LVM snapshots can result in duplicate UUIDs and labels, so LVM logical volumes should always be identified by logical volume name (/dev/mapper/name).

Kernel naming

You can get kernel naming descriptors using fdisk:

# fdisk -l
...
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       19458   156290016+  83  Linux

An example /etc/fstab using the kernel naming:

# <file system>        <dir>         <type>    <options>             <dump> <pass>
/dev/sda1              /             ext4      defaults              1      1

UUIDs

UUIDs are generated by the make-filesystem utilities (mkfs.*) when you create a filesystem. blkid will show you the UUIDs of mounted devices and partitions:

# blkid
/dev/sda1: UUID="6a60524d-061d-454a-bfd1-38989910eccd" TYPE="ext4"

An example /etc/fstab using the UUID identifiers:

# <file system>        <dir>         <type>    <options>             <dump> <pass>
UUID=6a60524d-061d-454a-bfd1-38989910eccd              /             ext4      defaults              1      1

Labels

The device or partition is required to be labelled first. To do this, you can use common applications like gparted to label partitions or you can use e2label to label ext2, ext3, and ext4 partitions. Keep in mind that not all file systems have labelling support (e.g. FAT file systems). Labels can be up to 16 characters long. Labels should be unambiguous, meaning that each label should be original to prevent any possible conflicts.

A device or partition must not be mounted before attempting to label them. Initially you will need to boot from a Live(CD/DVD/USB) before you can label with a gparted-like application or for ext partitions you can use e2label:

# e2label /dev/<disk-or-partition> Debian

An example /etc/fstab using the labels:

# <file system>        <dir>         <type>    <options>             <dump> <pass>
LABEL=Debian           /             ext4      defaults              1      1

See also


CategorySystemAdministration | CategoryStorage