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 and bind.

  • 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 or swap.

  • 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 to 0. The dump 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 value 1, while other file systems have 2. A value of 0 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.

  1. Open the /etc/fstab file in a text editor as the root user.
  2. Add a new line to the end of the file, to describe the system mount, or edit any existing lines to match any new requirements.
    Line entries match the following format:
    devicemount_pointfile_system_typeoptionsdumpfsck
    • device: the device name or the UUID of the device that contains the file system.
    • mount_point: the existing directory where the file system can be mounted.
    • file_system_type: the type of file system.
    • options: any file system specific options for the mount.
    • dump: this option is a legacy option and can be set to 0.
    • fsck: the order in which the file system is checked by the fsck utility, can be set to 0 or a positive integer.
    For example, an entry might look as follows:
    UUID=79428c8f-d67a-49ec-ba20-8a86337f4447 /mnt/data  xfs  defaults  0 0
  3. Save and close the file.
  4. Remount all file systems in /etc/fstab to apply any changes.
    sudo mount -a

    Note that the mount -a command mounts all file systems in /etc/fstab that don't have the noauto option set. If you added a mount that included the noauto option you must explicitly mount it for it to become active.