Managing the File System Mount Table
WARNING:
This documentation is a draft and is not meant for production use. Branch: OL10-FSADMIN
File systems can be configured in the file system mount table, or fstab, so that they can be automatically mounted at boot, or to make it easier to mount file systems at commonly used mount points with standard options applied at mount time.
The file system mount table is contained in the /etc/fstab
file, which
provides all the information that the mount
command requires to mount block
devices or implement binding of mounts. The following are typical entries from this file:
/dev/mapper/ocivolume-root / xfs defaults 0 0
UUID=5097b6ba-ed0e-418a-9c2c-fb25d577991f /boot xfs defaults 0 0
UUID=349C-BCCC /boot/efi vfat defaults,uid=0,gid=0,umask=077,shortname=winnt 0 2
/dev/mapper/ocivolume-oled /var/oled xfs defaults 0 0
tmpfs /dev/shm tmpfs defaults,nodev,nosuid,noexec 0 0
/.swapfile none swap sw 0 0
The descriptions of each field in the output are as follows:
-
The first field indicates the device to mount, which is specified by the device name, UUID, or device label, or the specification of a remote file system. A UUID or device label is preferable to a device name if the device name could change, for example:
LABEL=Projects /var/projects ext4 defaults 1 2
Note that the first field specifies the path of the file system, directory hierarchy, or file that's to be mounted on the mount point specified by the second field. The third and fourth fields are specified as
none
andbind
. -
The second field is the mount point for a file system. The mount point must be a path to either a file or a directory. Note that a swap partition isn't mounted to a traditional mount point.
-
The third field is the file system type, such as
xfs
orswap
. -
The fourth field specifies any mount options.
-
The fifth column is a legacy entry that was used to control the now deprecated
dump
command. This field must be set to0
. Thedump
command is removed in this Oracle Linux release. -
The sixth column identifies the order by which the
fsck
command performs a file system check at boot time. The root file system has the value1
, while other file systems have2
. A value of0
skips checking, as is appropriate for swap, for file systems that aren't mounted at boot time, and for binding of existing mounts.
For bind mounts, only the first four fields are specified, for example:
path mount_point none bind
For more information, see the fstab(5)
manual page.
The fstab is maintained as a simplified interface to systemd mount targets. At boot time, systemd reads the fstab and creates ephemeral mount target units for each of the entries.
Systemd mount units can provide much tighter control over when file systems are mounted. See Using systemd mount Targets for more information.
Editing /etc/fstab
For Persistent Mounts
Edit the /etc/fstab
file to add a new file system
mount.
The /etc/fstab
file contains information about the file systems
that are mounted automatically when the system boots. The file maintains
compatibility across Oracle Linux releases and continues to be used by many system
administrators instead of configuring individual systemd mount targets.
See Managing the File System Mount Table for more information.