man-pages/man5/fstab.5.html
2021-03-31 01:06:50 +01:00

338 lines
8.2 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of FSTAB</TITLE>
</HEAD><BODY>
<H1>FSTAB</H1>
Section: File Formats (5)<BR>Updated: February 2015<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
fstab - static information about the filesystems
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<I>/etc/fstab</I>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
The file
<B>fstab</B>
contains descriptive information about the filesystems the system can mount.
<B>fstab</B>
is only read by programs, and not written; it is the duty of the system
administrator to properly create and maintain this file. The order of records in
<B>fstab</B>
is important because
<B><A HREF="/cgi-bin/man/man2html?8+fsck">fsck</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+mount">mount</A></B>(8),
and
<B><A HREF="/cgi-bin/man/man2html?8+umount">umount</A></B>(8)
sequentially iterate through
<B>fstab</B>
doing their thing.
<P>
Each filesystem is described on a separate line.
Fields on each line are separated by tabs or spaces.
Lines starting with '#' are comments. Blank lines are ignored.
<P>
The following is a typical example of an
<B>fstab</B>
entry:
<P>
<DL COMPACT><DT id="1"><DD>
LABEL=t-home2 /home ext4 defaults,auto_da_alloc 0 2
</DL>
<P>
<B>The first field</B>
(<I>fs_spec</I>).
<DL COMPACT><DT id="2"><DD>
This field describes the block special device or
remote filesystem to be mounted.
<P>
For ordinary mounts, it will hold (a link to) a block special
device node (as created by
<B><A HREF="/cgi-bin/man/man2html?8+mknod">mknod</A></B>(8))
for the device to be mounted, like `/dev/cdrom' or `/dev/sdb7'.
For NFS mounts, this field is &lt;host&gt;:&lt;dir&gt;, e.g., `knuth.aeb.nl:/'.
For filesystems with no storage, any string can be used, and will show up in
<B><A HREF="/cgi-bin/man/man2html?1+df">df</A></B>(1)
output, for example. Typical usage is `proc' for procfs; `mem', `none',
or `tmpfs' for tmpfs. Other special filesystems, like udev and sysfs,
are typically not listed in
<B>fstab</B>.
<P>
LABEL=&lt;label&gt; or UUID=&lt;uuid&gt; may be given instead of a device name.
This is the recommended method, as device names are often a coincidence
of hardware detection order, and can change when other disks are added or removed.
For example, `LABEL=Boot' or `UUID=3e6be9de-8139-11d1-9106-a43f08d823a6'.
(Use a filesystem-specific tool like
<B><A HREF="/cgi-bin/man/man2html?8+e2label">e2label</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+xfs_admin">xfs_admin</A></B>(8),
or
<B><A HREF="/cgi-bin/man/man2html?8+fatlabel">fatlabel</A></B>(8)
to set LABELs on filesystems).
<P>
It's also possible to use PARTUUID= and PARTLABEL=. These partitions identifiers
are supported for example for GUID Partition Table (GPT).
<P>
See
<B><A HREF="/cgi-bin/man/man2html?8+mount">mount</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+blkid">blkid</A></B>(8)
or
<B><A HREF="/cgi-bin/man/man2html?8+lsblk">lsblk</A></B>(8)
for more details about device identifiers.
<P>
<P>
Note that
<B><A HREF="/cgi-bin/man/man2html?8+mount">mount</A></B>(8)
uses UUIDs as strings. The string representation of the UUID should be based on
lower case characters.
</DL>
<P>
<B>The second field</B>
(<I>fs_file</I>).
<DL COMPACT><DT id="3"><DD>
This field describes the mount point (target) for the 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.
</DL>
<P>
<B>The third field</B>
(<I>fs_vfstype</I>).
<DL COMPACT><DT id="4"><DD>
This field describes the type of the filesystem. Linux supports many
filesystem types: ext4, xfs, btrfs, f2fs, vfat, ntfs, hfsplus,
tmpfs, sysfs, proc, iso9660, udf, squashfs, nfs, cifs, and many more.
For more details, see
<B><A HREF="/cgi-bin/man/man2html?8+mount">mount</A></B>(8).
<P>
An entry
<I>swap</I>
denotes a file or partition to be used
for swapping, cf.
<B><A HREF="/cgi-bin/man/man2html?8+swapon">swapon</A></B>(8).
An entry
<I>none</I>
is useful for bind or move mounts.
<P>
More than one type may be specified in a comma-separated list.
<P>
<B><A HREF="/cgi-bin/man/man2html?8+mount">mount</A></B>(8)
and
<B><A HREF="/cgi-bin/man/man2html?8+umount">umount</A></B>(8)
support filesystem
<I>subtypes</I>.
The subtype is defined by '.subtype' suffix. For
example 'fuse.sshfs'. It's recommended to use subtype notation rather than add
any prefix to the first fstab field (for example 'sshfs#example.com' is
deprecated).
</DL>
<P>
<B>The fourth field</B>
(<I>fs_mntops</I>).
<DL COMPACT><DT id="5"><DD>
This field describes the mount options associated with the filesystem.
<P>
It is formatted as a comma-separated list of options.
It contains at least the type of mount
(<B>ro</B>
or
<B>rw</B>),
plus any additional options appropriate to the filesystem
type (including performance-tuning options).
For details, see
<B><A HREF="/cgi-bin/man/man2html?8+mount">mount</A></B>(8)
or
<B><A HREF="/cgi-bin/man/man2html?8+swapon">swapon</A></B>(8).
<P>
Basic filesystem-independent options are:
<DL COMPACT>
<DT id="6"><B>defaults</B>
<DD>
use default options: rw, suid, dev, exec, auto, nouser, and async.
<DT id="7"><B>noauto</B>
<DD>
do not mount when &quot;mount -a&quot; is given (e.g., at boot time)
<DT id="8"><B>user</B>
<DD>
allow a user to mount
<DT id="9"><B>owner</B>
<DD>
allow device owner to mount
<DT id="10"><B>comment</B>
<DD>
or
<B>x-&lt;name&gt;</B>
for use by fstab-maintaining programs
<DT id="11"><B>nofail</B>
<DD>
do not report errors for this device if it does not exist.
</DL>
</DL>
<P>
<B>The fifth field</B>
(<I>fs_freq</I>).
<DL COMPACT><DT id="12"><DD>
This field is used by
<B><A HREF="/cgi-bin/man/man2html?8+dump">dump</A></B>(8)
to determine which filesystems need to be dumped.
Defaults to zero (don't dump) if not present.
</DL>
<P>
<B>The sixth field</B>
(<I>fs_passno</I>).
<DL COMPACT><DT id="13"><DD>
This field is used by
<B><A HREF="/cgi-bin/man/man2html?8+fsck">fsck</A></B>(8)
to determine the order in which filesystem checks are done at
boot time. The root filesystem should be specified with a
<I>fs_passno</I>
of 1. Other filesystems should have a
<I>fs_passno</I>
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 fsck) if not present.
<P>
</DL>
<A NAME="lbAE">&nbsp;</A>
<H2>NOTES</H2>
The proper way to read records from
<B>fstab</B>
is to use the routines
<B><A HREF="/cgi-bin/man/man2html?3+getmntent">getmntent</A></B>(3)
or
<B>libmount</B>.
<P>
The keyword
<B>ignore</B>
as a filesystem type (3rd field) is no longer supported by the pure
libmount based mount utility (since util-linux v2.22).
<P>
<A NAME="lbAF">&nbsp;</A>
<H2>FILES</H2>
<I>/etc/fstab</I>,
<I>&lt;<A HREF="file:///usr/include/fstab.h">fstab.h</A>&gt;</I>
<A NAME="lbAG">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?3+getmntent">getmntent</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?5+fs">fs</A></B>(5),
<B><A HREF="/cgi-bin/man/man2html?8+findmnt">findmnt</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+mount">mount</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+swapon">swapon</A></B>(8)
<A NAME="lbAH">&nbsp;</A>
<H2>HISTORY</H2>
The ancestor of this
<B>fstab</B>
file format appeared in 4.0BSD.
<A NAME="lbAI">&nbsp;</A>
<H2>AVAILABILITY</H2>
This man page is part of the util-linux package and is available from
<A HREF="https://www.kernel.org/pub/linux/utils/util-linux/.">https://www.kernel.org/pub/linux/utils/util-linux/.</A>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="14"><A HREF="#lbAB">NAME</A><DD>
<DT id="15"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="16"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="17"><A HREF="#lbAE">NOTES</A><DD>
<DT id="18"><A HREF="#lbAF">FILES</A><DD>
<DT id="19"><A HREF="#lbAG">SEE ALSO</A><DD>
<DT id="20"><A HREF="#lbAH">HISTORY</A><DD>
<DT id="21"><A HREF="#lbAI">AVAILABILITY</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:06:03 GMT, March 31, 2021
</BODY>
</HTML>