Difference between revisions of "Fstab"
Views
Actions
Namespaces
Variants
Tools
m (Specified root owns fstab) |
(discard=pages) |
||
(7 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
<languages/> | |||
__TOC__ | __TOC__ | ||
<translate> | |||
= fstab usage = | = fstab usage = <!--T:1--> | ||
The {{ic|/etc/fstab}} root-owned configuration file is used to define how disk partitions, various other block devices, or remote filesystems should be mounted into the filesystem. | The {{ic|/etc/fstab}} root-owned configuration file is used to define how disk partitions, various other block devices, or remote filesystems should be mounted into the filesystem. | ||
<!--T:2--> | |||
Each filesystem is described in a separate line. These definitions will be converted into systemd mount units dynamically at boot, or when the configuration of the system manager is reloaded. | Each filesystem is described in a separate line. These definitions will be converted into systemd mount units dynamically at boot, or when the configuration of the system manager is reloaded. | ||
<!--T:3--> | |||
The {{ic|mount --all}} command will mount all filesystems mentioned in {{ic|fstab}}, (except for those whose line contains the {{ic|noauto}} keyword). The filesystems are mounted following their order in {{ic|fstab}}. The mount command compares filesystem source and target to detect already mounted filesystems. The kernel table with already mounted filesystems is cached during {{ic|mount --all}}. This means that all duplicated fstab entries will be mounted. | The {{ic|mount --all}} command will mount all filesystems mentioned in {{ic|fstab}}, (except for those whose line contains the {{ic|noauto}} keyword). The filesystems are mounted following their order in {{ic|fstab}}. The mount command compares filesystem source and target to detect already mounted filesystems. The kernel table with already mounted filesystems is cached during {{ic|mount --all}}. This means that all duplicated fstab entries will be mounted. | ||
= Example File = | = Example File = <!--T:4--> | ||
Each line in the file describes a filesystem, and contain fields (specified in columns) used to provide information about its mountpoint, the options which should be used when mounting it etc. Each field can be separated from one another either by spaces or tabs: | Each line in the file describes a filesystem, and contain fields (specified in columns) used to provide information about its mountpoint, the options which should be used when mounting it etc. Each field can be separated from one another either by spaces or tabs: | ||
# /etc/fstab: static file system information. | # /etc/fstab: static file system information. | ||
Line 14: | Line 17: | ||
LABEL=ESP /boot/efi vfat umask=0077 0 2 | LABEL=ESP /boot/efi vfat umask=0077 0 2 | ||
/dev/sda5 / ext4 defaults,noatime,discard 0 1 | /dev/sda5 / ext4 defaults,noatime,discard 0 1 | ||
UUID=18360b04-a96d-4a99-8323-b07717f36a31 | UUID=18360b04-a96d-4a99-8323-b07717f36a31 none swap defaults,discard=pages 0 0 | ||
UUID=b4108631-e051-48d8-b2ff-a1d924a893f1 /home ext4 defaults,noatime,discard 0 2 | UUID=b4108631-e051-48d8-b2ff-a1d924a893f1 /home ext4 defaults,noatime,discard 0 2 | ||
UUID=634E43D367B0A4B1 /run/media/data ntfs-3g noauto,x-systemd.automount,x-systemd.device-timeout=10,rw,inherit,permissions,streams_interface=windows,windows_names,compression,norecover,hide_dot_files,hide_hid_files,big_writes 0 2 | |||
UUID=634E43D367B0A4B1 /media/ | |||
<!--T:5--> | |||
Each column in the above are the fstab "fields" and will be explained in the next section. | Each column in the above are the fstab "fields" and will be explained in the next section. | ||
= Field definitions = | = Field definitions = <!--T:6--> | ||
== Filesystem Specification == | == Filesystem Specification == | ||
This field describes one of each of the following: | This field describes one of each of the following: | ||
Line 29: | Line 32: | ||
* swap file or swap partition to be enabled | * swap file or swap partition to be enabled | ||
<!--T:7--> | |||
This field generally takes the form of: | This field generally takes the form of: | ||
* /dev/XdY | * /dev/XdY | ||
* LABEL=<label> | * LABEL=< label> | ||
* UUID=<uuid> | * UUID=<uuid> | ||
to uniquely identify a filesystem you want to mount. | to uniquely identify a filesystem you want to mount. | ||
As a [https://en.wikipedia.org/wiki/Universally_unique_identifier UUID] is necessarily unique, you will find that this is the | As a [https://en.wikipedia.org/wiki/Universally_unique_identifier UUID] is necessarily unique, you will find that this is the default in use on more modern systems whereas a device name and label are only in use on older systems, so we'll concentrate on UUIDs in this tutorial, but know that if you insist on using these order systems, they still work at the time of this writing. | ||
<!--T:8--> | |||
To get the UUID for all of your devices, execute the command {{ic|blkid}} elevated to root: | To get the UUID for all of your devices, execute the command {{ic|blkid}} elevated to root: | ||
sudo blkid | <!--T:9--> | ||
{{UserCmd|command=sudo blkid}} | |||
<!--T:10--> | |||
and you'll get someting like this: | and you'll get someting like this: | ||
/dev/sda1: LABEL_FATBOOT="ESP" LABEL="ESP" UUID="2462-755F" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="b86c0cae-3055-4d9e-9e12-1fa1e2cd32d2" | <!--T:11--> | ||
/dev/sda1: LABEL_FATBOOT="ESP" LABEL="ESP" UUID="2462-755F" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="b86c0cae-3055-4d9e-9e12-1fa1e2cd32d2" | |||
/dev/sda2: PARTLABEL="Microsoft reserved partition" PARTUUID="b0679b89-007c-441b-88a3-74a39f1f8b2b" | /dev/sda2: PARTLABEL="Microsoft reserved partition" PARTUUID="b0679b89-007c-441b-88a3-74a39f1f8b2b" | ||
/dev/sda3: LABEL="WINSYS" BLOCK_SIZE="512" UUID="029873F49873E497" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="f8d444b9-ec60-4ac8-b12a-52448119fad1" | /dev/sda3: LABEL="WINSYS" BLOCK_SIZE="512" UUID="029873F49873E497" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="f8d444b9-ec60-4ac8-b12a-52448119fad1" | ||
Line 53: | Line 61: | ||
/dev/sdc1: LABEL="Win-Data" BLOCK_SIZE="512" UUID="634E43D367B0A4B1" TYPE="ntfs" PARTUUID="ca8d0663-6a6e-4b09-a0d7-05b59d109ab1" | /dev/sdc1: LABEL="Win-Data" BLOCK_SIZE="512" UUID="634E43D367B0A4B1" TYPE="ntfs" PARTUUID="ca8d0663-6a6e-4b09-a0d7-05b59d109ab1" | ||
<!--T:12--> | |||
Any one of the output of {{ic|blkid}} can be used as the first field in the fstab file. | Any one of the output of {{ic|blkid}} can be used as the first field in the fstab file. | ||
<!--T:13--> | |||
E.G. '''all''' of the following lines are valid entries ''for the first line'' of the output of the above example: | E.G. '''all''' of the following lines are valid entries ''for the first line'' of the output of the above example: | ||
# <file system> <mount point> <type> <options> <dump> <pass> | # <file system> <mount point> <type> <options> <dump> <pass> | ||
Line 62: | Line 72: | ||
UUID=b86c0cae-3055-4d9e-9e12-1fa1e2cd32d2 /boot/efi vfat umask=0077 0 2 | UUID=b86c0cae-3055-4d9e-9e12-1fa1e2cd32d2 /boot/efi vfat umask=0077 0 2 | ||
<!--T:14--> | |||
I.E. only one of the above lines should be present in your fstab file to mount the ESP partition, but any of them will work! | I.E. only one of the above lines should be present in your fstab file to mount the ESP partition, but any of them will work! | ||
''However'' it is strongly recommended to use the UUID as that is '''globally unique!'''. This means that if your move a disk to another machine, it will keep its UUID and there is no opportunity for surprises like the computer you've moved the existing disk to suddenly: | ''However'' it is strongly recommended to use the UUID as that is '''globally unique!'''. This means that if your move a disk to another machine, it will keep its UUID and there is no opportunity for surprises like the computer you've moved the existing disk to suddenly: | ||
* booting from the '''E'''FI '''S'''ystem '''P'''artition on the new disk instead of its own ESP | * booting from the '''E'''FI '''S'''ystem '''P'''artition on the new disk instead of its own ESP | ||
* failing to mount its own Windows partition because you just added another one and this takes precedence (or not: depending on the exact kernel version and filesystem driver resulting in a boot only working 50% of the time and other weird problems) | * failing to mount its own Windows partition because you just added another one and this takes precedence (or not: depending on the exact kernel version and filesystem driver resulting in a boot only working 50% of the time and other weird problems) | ||
* failing to mount a disk because the disk you just inserted into M2 slot #1 gets named /dev/sda and the one in slot #2 which used to be called /dev/sda now suddenly becomes / | * failing to mount a disk because the disk you just inserted into M2 slot #1 gets named /dev/sda and the one in slot #2 which used to be called /dev/sda now suddenly becomes /dev/sdb. | ||
* etc, etc. | * etc, etc. | ||
== Mount Point == | == Mount Point == <!--T:15--> | ||
This field describes the mount point (target) inside your filesystem. For swap partitions, this field should be specified as `none'. If the name of the mount point contains spaces or tabs these can be escaped as `\040' and '\011' respectively. | This field describes the mount point (target) inside your filesystem. For swap partitions, this field should be specified as `none'. If the name of the mount point contains spaces or tabs these can be escaped as `\040' and '\011' respectively. | ||
For more information on the Linux Filesystem Hierarchy standard refer to the [[#See Also]] section, but in a nutshell you should specify an existing directory on your | <!--T:16--> | ||
For more information on the Linux Filesystem Hierarchy standard refer to the [[#See Also]] section, but in a nutshell you should specify an existing directory on your filesystem where you want to mount a partition. | |||
<!--T:17--> | |||
In the example {{ic|fstab}} file above, the following line in it's {{ic|blkid}} output: | In the example {{ic|fstab}} file above, the following line in it's {{ic|blkid}} output: | ||
/dev/sdc1: LABEL="Win-Data" BLOCK_SIZE="512" UUID="634E43D367B0A4B1" TYPE="ntfs" PARTUUID="ca8d0663-6a6e-4b09-a0d7-05b59d109ab1" | /dev/sdc1: LABEL="Win-Data" BLOCK_SIZE="512" UUID="634E43D367B0A4B1" TYPE="ntfs" PARTUUID="ca8d0663-6a6e-4b09-a0d7-05b59d109ab1" | ||
Line 82: | Line 95: | ||
* has a partition UUID of "ca8d0663-6a6e-4b09-a0d7-05b59d109ab1" | * has a partition UUID of "ca8d0663-6a6e-4b09-a0d7-05b59d109ab1" | ||
<!--T:18--> | |||
and gets mounted on the {{ic|/media/Data}} according to this line: | and gets mounted on the {{ic|/media/Data}} according to this line: | ||
UUID=634E43D367B0A4B1 /media/Data ntfs-3g noauto,x-systemd.automount,x-systemd.device-timeout=10,rw,inherit,permissions,streams_interface=windows,windows_names,compression,norecover,hide_dot_files,hide_hid_files,big_writes 0 2 | UUID=634E43D367B0A4B1 /media/Data ntfs-3g noauto,x-systemd.automount,x-systemd.device-timeout=10,rw,inherit,permissions,streams_interface=windows,windows_names,compression,norecover,hide_dot_files,hide_hid_files,big_writes 0 2 | ||
== Filesystem Type == | == Filesystem Type == <!--T:19--> | ||
This field describes the type of the filesystem. Linux supports many filesystem types: ext4, xfs, btrfs, f2fs, vfat, ntfs-3g (for Windows compatibility), hfsplus (for Mac Compatibility), tmpfs, sysfs, proc, iso9660 (to allow you to mount CD/DVD ISO files as Read-Only directories), udf, squashfs, nfs, cifs, and many more. | This field describes the type of the filesystem. Linux supports many filesystem types: ext4, xfs, btrfs, f2fs, vfat, ntfs-3g (for Windows compatibility), hfsplus (for Mac Compatibility), tmpfs, sysfs, proc, iso9660 (to allow you to mount CD/DVD ISO files as Read-Only directories), udf, squashfs, nfs, cifs, and many more. | ||
<!--T:20--> | |||
An entry swap denotes a file or partition to be used for swapping. | An entry swap denotes a file or partition to be used for swapping. | ||
An entry none is useful for bind or move mounts. | An entry none is useful for bind or move mounts. | ||
<!--T:21--> | |||
More than one type may be specified in a comma-separated list. | More than one type may be specified in a comma-separated list. | ||
<!--T:22--> | |||
Using the same example {{ic|fstab}} file and "Win-Data" line as above, {{ic|ntfs-3g}} is the file system we're mounting this one under although the {{ic|blkid}} shows {{ic|ntfs}}. This is simply because the {{ic|ntfs}} driver is a read-only driver (allowing you to see your Windows files, but not modify them, whereas the {{ic|ntfs-3g}} (for 3rd generation) allows most NTFS options (except encryption) thus also read-write capabilities: | Using the same example {{ic|fstab}} file and "Win-Data" line as above, {{ic|ntfs-3g}} is the file system we're mounting this one under although the {{ic|blkid}} shows {{ic|ntfs}}. This is simply because the {{ic|ntfs}} driver is a read-only driver (allowing you to see your Windows files, but not modify them, whereas the {{ic|ntfs-3g}} (for 3rd generation) allows most NTFS options (except encryption) thus also read-write capabilities: | ||
UUID=634E43D367B0A4B1 /media/Data ntfs-3g noauto,x-systemd.automount,x-systemd.device-timeout=10,rw,inherit,permissions,streams_interface=windows,windows_names,compression,norecover,hide_dot_files,hide_hid_files,big_writes 0 2 | <!--T:23--> | ||
UUID=634E43D367B0A4B1 /media/Data ntfs-3g noauto,x-systemd.automount,x-systemd.device-timeout=10,rw,inherit,permissions,streams_interface=windows,windows_names,compression,norecover,hide_dot_files,hide_hid_files,big_writes 0 2 | |||
== Mount options == | == Mount options == <!--T:24--> | ||
This field describes the mount options associated with the filesystem. | This field describes the mount options associated with the filesystem. | ||
<!--T:25--> | |||
It is formatted as a comma-separated list of options. It contains at least the type of mount (ro or rw), plus any additional options appropriate to the filesystem type (including performance-tuning options). | It is formatted as a comma-separated list of options. It contains at least the type of mount (ro or rw), plus any additional options appropriate to the filesystem type (including performance-tuning options). | ||
<!--T:26--> | |||
Basic filesystem-independent options are: | Basic filesystem-independent options are: | ||
* defaults: use default options: rw, suid, dev, exec, auto, nouser, and async. | * defaults: use default options: rw, suid, dev, exec, auto, nouser, and async. | ||
Line 110: | Line 130: | ||
* nofail: do not report errors for this device if it does not exist. | * nofail: do not report errors for this device if it does not exist. | ||
=== FAT Mount options === | === FAT Mount options === <!--T:27--> | ||
TBD | TBD | ||
=== EXT2/3/4 Mount options === | === EXT2/3/4 Mount options === <!--T:28--> | ||
TBD | TBD | ||
=== NTFS-3G Mount options === | === NTFS-3G Mount options === <!--T:29--> | ||
TBD | TBD | ||
== Dump? == | == Dump? == <!--T:30--> | ||
This field must be 1 or 0 and is used by {{ic|dump}} to determine which filesystems need to be dumped in case of a coredump (=crash). Defaults to zero (don’t dump) if not present. | This field must be 1 or 0 and is used by {{ic|dump}} to determine which filesystems need to be dumped in case of a coredump (=crash). Defaults to zero (don’t dump) if not present. | ||
== Pass number == | == Pass number == <!--T:31--> | ||
This field is used by fsck(8) to determine the order in which filesystem checks are done at boot time. The root filesystem ''should be'' specified with a fs_passno of 1. Other filesystems should have a fs_passno of 2. Filesystems within a drive will be checked sequentially, but filesystems on different drives will be checked at the same time to utilize parallelism available in the hardware. | This field is used by fsck(8) to determine the order in which filesystem checks are done at boot time. The root filesystem ''should be'' specified with a fs_passno of 1. Other filesystems should have a fs_passno of 2. Filesystems within a drive will be checked sequentially, but filesystems on different drives will be checked at the same time to utilize parallelism available in the hardware. | ||
<!--T:32--> | |||
Defaults to zero (don’t check the filesystem) if not present. | Defaults to zero (don’t check the filesystem) if not present. | ||
= Tips and tricks = | = Tips and tricks = <!--T:33--> | ||
The default setup will automatically `fsck` and `mount` filesystems before starting services that need them to be mounted. For example, systemd automatically makes sure that remote filesystem mounts like NFS or Samba are only started after the network has been set up. Therefore, local and remote filesystem mounts specified in `/etc/fstab` should work out of the box. See {{man 5 systemd.mount}} for details. | The default setup will automatically `fsck` and `mount` filesystems before starting services that need them to be mounted. For example, systemd automatically makes sure that remote filesystem mounts like NFS or Samba are only started after the network has been set up. Therefore, local and remote filesystem mounts specified in `/etc/fstab` should work out of the box. See {{UserCmd|command=man 5 systemd.mount}} for details. | ||
=See Also= | =See Also= <!--T:34--> | ||
https://refspecs.linuxfoundation.org/FHS_3.0/index.html | https://refspecs.linuxfoundation.org/FHS_3.0/index.html | ||
</translate> | |||
[[Category:Contents Page{{#translation:}}]] | |||
< | |||
[[Category: |
Latest revision as of 18:13, 14 September 2023
fstab usage
The /etc/fstab
root-owned configuration file is used to define how disk partitions, various other block devices, or remote filesystems should be mounted into the filesystem.
Each filesystem is described in a separate line. These definitions will be converted into systemd mount units dynamically at boot, or when the configuration of the system manager is reloaded.
The mount --all
command will mount all filesystems mentioned in fstab
, (except for those whose line contains the noauto
keyword). The filesystems are mounted following their order in fstab
. The mount command compares filesystem source and target to detect already mounted filesystems. The kernel table with already mounted filesystems is cached during mount --all
. This means that all duplicated fstab entries will be mounted.
Example File
Each line in the file describes a filesystem, and contain fields (specified in columns) used to provide information about its mountpoint, the options which should be used when mounting it etc. Each field can be separated from one another either by spaces or tabs:
# /etc/fstab: static file system information. # <file system> <mount point> <type> <options> <dump> <pass> LABEL=ESP /boot/efi vfat umask=0077 0 2 /dev/sda5 / ext4 defaults,noatime,discard 0 1 UUID=18360b04-a96d-4a99-8323-b07717f36a31 none swap defaults,discard=pages 0 0 UUID=b4108631-e051-48d8-b2ff-a1d924a893f1 /home ext4 defaults,noatime,discard 0 2 UUID=634E43D367B0A4B1 /run/media/data ntfs-3g noauto,x-systemd.automount,x-systemd.device-timeout=10,rw,inherit,permissions,streams_interface=windows,windows_names,compression,norecover,hide_dot_files,hide_hid_files,big_writes 0 2
Each column in the above are the fstab "fields" and will be explained in the next section.
Field definitions
Filesystem Specification
This field describes one of each of the following:
- the block special device
- remote filesystem
- filesystem image for loop device to be mounted
- swap file or swap partition to be enabled
This field generally takes the form of:
- /dev/XdY
- LABEL=< label>
- UUID=<uuid>
to uniquely identify a filesystem you want to mount. As a UUID is necessarily unique, you will find that this is the default in use on more modern systems whereas a device name and label are only in use on older systems, so we'll concentrate on UUIDs in this tutorial, but know that if you insist on using these order systems, they still work at the time of this writing.
To get the UUID for all of your devices, execute the command blkid
elevated to root:
and you'll get someting like this:
/dev/sda1: LABEL_FATBOOT="ESP" LABEL="ESP" UUID="2462-755F" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="b86c0cae-3055-4d9e-9e12-1fa1e2cd32d2" /dev/sda2: PARTLABEL="Microsoft reserved partition" PARTUUID="b0679b89-007c-441b-88a3-74a39f1f8b2b" /dev/sda3: LABEL="WINSYS" BLOCK_SIZE="512" UUID="029873F49873E497" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="f8d444b9-ec60-4ac8-b12a-52448119fad1" /dev/sda4: BLOCK_SIZE="512" UUID="0EB23063B2305207" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="cb083fb5-d61c-48e3-a657-ceb363a983b1" /dev/sda5: UUID="9b539186-41e9-46f0-a515-1ec6c3544367" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="7bd52fb7-4d7d-412c-bc01-e3c98c7f3bb1" /dev/sda6: UUID="b4108631-e051-48d8-b2ff-a1d924a893f0" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="9683d669-e0fd-496a-bd9c-f0e51d0bd561" /dev/sda7: UUID="18360b04-a96d-4a99-8323-b07717f36a30" TYPE="swap" PARTUUID="7434de88-dd5c-4ce5-a6e2-4bb65c16eab5" /dev/sdb2: UUID="26055107-28cd-457e-9a31-46781de4065d" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="86bdde2c-b92c-43fc-811a-6d0cdc312be1" /dev/sdb3: UUID="c9dd0f4c-5793-446e-90bb-d10e27bf4922" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="d02838bd-371c-4673-96ed-8aad73bb6d91" /dev/sdc1: LABEL="Win-Data" BLOCK_SIZE="512" UUID="634E43D367B0A4B1" TYPE="ntfs" PARTUUID="ca8d0663-6a6e-4b09-a0d7-05b59d109ab1"
Any one of the output of blkid
can be used as the first field in the fstab file.
E.G. all of the following lines are valid entries for the first line of the output of the above example:
# <file system> <mount point> <type> <options> <dump> <pass> LABEL=ESP /boot/efi vfat umask=0077 0 2 UUID=2462-755F /boot/efi vfat umask=0077 0 2 LABEL=EFI\040system\040partition /boot/efi vfat umask=0077 0 2 UUID=b86c0cae-3055-4d9e-9e12-1fa1e2cd32d2 /boot/efi vfat umask=0077 0 2
I.E. only one of the above lines should be present in your fstab file to mount the ESP partition, but any of them will work! However it is strongly recommended to use the UUID as that is globally unique!. This means that if your move a disk to another machine, it will keep its UUID and there is no opportunity for surprises like the computer you've moved the existing disk to suddenly:
- booting from the EFI System Partition on the new disk instead of its own ESP
- failing to mount its own Windows partition because you just added another one and this takes precedence (or not: depending on the exact kernel version and filesystem driver resulting in a boot only working 50% of the time and other weird problems)
- failing to mount a disk because the disk you just inserted into M2 slot #1 gets named /dev/sda and the one in slot #2 which used to be called /dev/sda now suddenly becomes /dev/sdb.
- etc, etc.
Mount Point
This field describes the mount point (target) inside your filesystem. For swap partitions, this field should be specified as `none'. If the name of the mount point contains spaces or tabs these can be escaped as `\040' and '\011' respectively.
For more information on the Linux Filesystem Hierarchy standard refer to the #See Also section, but in a nutshell you should specify an existing directory on your filesystem where you want to mount a partition.
In the example fstab
file above, the following line in it's blkid
output:
/dev/sdc1: LABEL="Win-Data" BLOCK_SIZE="512" UUID="634E43D367B0A4B1" TYPE="ntfs" PARTUUID="ca8d0663-6a6e-4b09-a0d7-05b59d109ab1"
- is the Windows D: Drive
- has an NTFS label of "Win-Data"
- has a Windows UUID of "634E43D367B0A4B1" (different from Linux UUIDs)
- contains the NTFS File System
- has a partition UUID of "ca8d0663-6a6e-4b09-a0d7-05b59d109ab1"
and gets mounted on the /media/Data
according to this line:
UUID=634E43D367B0A4B1 /media/Data ntfs-3g noauto,x-systemd.automount,x-systemd.device-timeout=10,rw,inherit,permissions,streams_interface=windows,windows_names,compression,norecover,hide_dot_files,hide_hid_files,big_writes 0 2
Filesystem Type
This field describes the type of the filesystem. Linux supports many filesystem types: ext4, xfs, btrfs, f2fs, vfat, ntfs-3g (for Windows compatibility), hfsplus (for Mac Compatibility), tmpfs, sysfs, proc, iso9660 (to allow you to mount CD/DVD ISO files as Read-Only directories), udf, squashfs, nfs, cifs, and many more.
An entry swap denotes a file or partition to be used for swapping. An entry none is useful for bind or move mounts.
More than one type may be specified in a comma-separated list.
Using the same example fstab
file and "Win-Data" line as above, ntfs-3g
is the file system we're mounting this one under although the blkid
shows ntfs
. This is simply because the ntfs
driver is a read-only driver (allowing you to see your Windows files, but not modify them, whereas the ntfs-3g
(for 3rd generation) allows most NTFS options (except encryption) thus also read-write capabilities:
UUID=634E43D367B0A4B1 /media/Data ntfs-3g noauto,x-systemd.automount,x-systemd.device-timeout=10,rw,inherit,permissions,streams_interface=windows,windows_names,compression,norecover,hide_dot_files,hide_hid_files,big_writes 0 2
Mount options
This field describes the mount options associated with the filesystem.
It is formatted as a comma-separated list of options. It contains at least the type of mount (ro or rw), plus any additional options appropriate to the filesystem type (including performance-tuning options).
Basic filesystem-independent options are:
- defaults: use default options: rw, suid, dev, exec, auto, nouser, and async.
- noauto: do not mount when mount -a is given (I.E. at boot time)
- user: allow any user to mount (I.E. no
sudo
needed) - owner: Only allow device owner to mount
- comment: or x-<name> for use by fstab-maintaining programs
- nofail: do not report errors for this device if it does not exist.
FAT Mount options
TBD
EXT2/3/4 Mount options
TBD
NTFS-3G Mount options
TBD
Dump?
This field must be 1 or 0 and is used by dump
to determine which filesystems need to be dumped in case of a coredump (=crash). Defaults to zero (don’t dump) if not present.
Pass number
This field is used by fsck(8) to determine the order in which filesystem checks are done at boot time. The root filesystem should be specified with a fs_passno of 1. Other filesystems should have a fs_passno of 2. Filesystems within a drive will be checked sequentially, but filesystems on different drives will be checked at the same time to utilize parallelism available in the hardware.
Defaults to zero (don’t check the filesystem) if not present.
Tips and tricks
The default setup will automatically `fsck` and `mount` filesystems before starting services that need them to be mounted. For example, systemd automatically makes sure that remote filesystem mounts like NFS or Samba are only started after the network has been set up. Therefore, local and remote filesystem mounts specified in `/etc/fstab` should work out of the box. See
for details.