Fstab mount options: definition, types, formats, tips and tricks for getting the job done

Table of contents:

Fstab mount options: definition, types, formats, tips and tricks for getting the job done
Fstab mount options: definition, types, formats, tips and tricks for getting the job done
Anonim

Fstab is valid for any Linux OS: Debian, Mandrake, Mandriva and Suse and more. The function contains data about fstab mount options in file systems, where and with what options to combine them. For NFS, it contains the server name and directory exported to that server, the local directory that is the build point, and other NFS-specific options that control the quality of the process.

FSTAB knowledge and capabilities

To work with the function, first of all, determine the device on which the partition is located. For a SATA drive, the first is called sda, the second is sdb, and so on. The partitions for the first disk are named sda1 and sda2. For an IDE disk, the nomenclature will be hda, hdb, and partitions hda1, hda2. The descriptors for all devices and their respective partitions are located in the /dev directory. To determine which partitions to mount, use the fdisk tool as a probing argument. To view partitions, for example, from an sda disk, write:

fdisk /dev/sda.

Using fdisk, you canhandle partitions in a flexible and safe way. By entering p, a list of partitions will appear. For example.

fstab mount option
fstab mount option

After identification, use the fstab mount option. The structure of this file uses a special syntax. The lines consist of six separated fields with their own value: space, tab or combination.

Rows consist of six separated fields
Rows consist of six separated fields

The path to the descriptor will be /dev/sda3, the first field will be the route, the second will be the directory where you want to mount the partition, for example, in /media/DATOS. The filesystem of this partition is ntfs fstab-mount and will be listed in the third field. The fourth field lists mounting options. The fifth and sixth fields leave 0.

Man pages option

man pages option
man pages option

If you specify the Auto option, the partition will be mounted at system startup, but there is also the opposite option noauto. Exec is added if one is interested in executing binaries on a partition. They need to be programmed and executed, the opposite option is noexec.

When mounting a Rw partition, if you want the partition to be readable, use the corresponding ro parameter. The uid option of the fstab mount specifies how OS users have access to file staging. You can check which number corresponds to each user by examining the file /etc/passwd.

Similarly to the previous parameter, Gid refers to a group of users. You can see the gid group in /etc/groups. Fmask is the umask for the partition you wantmount. This way you can specify the permissions they will have. Because the data partition is owned by the user, it is given the same permissions as home by default, readable and writable by the owner specified in the uid to be readable by users of the same group specified in the file's git.

Dmask is the same as the previous fstab mount option, but in this case it refers to directories. To open a directory, the user will need execute permissions similar to files.

Mount order

Mount Order
Mount Order

In order to run the function, use the mount order, in which you will need to pass the argument a and build what is in fstab when mounting disks. To do this, write:

$ sudo umount –a.

To parse a device that is in use, check which process is doing it with the fuse instruction and the partition descriptor as follows:

$ sudo fuse -m /dev/sda3.

The instruction will show the PID of the processes that occupy the partition. It can be destroyed, disassembled and reassembled with:

$ sudo kill -9 7418$ sudo umount -a$ sudo mount -a.

Go to the section and check if the permissions are correct with a ls. This process will mount files with the same permission as Home in order for them to be integrated.

Automatic fstab function

Automatic fstab function
Automatic fstab function

The /etc/fstab file is used forsetting the cifs fstab mount scheme and integrating partitions, various block devices or remote files into the system, described on a separate line. These definitions are converted by systemd into dynamic built modules at startup and after configuration is reloaded by the system administrator.

The file is read by the mount command, it is enough to find any of the directories or devices specified in the file to complete the value of the next parameter. This applies the mounting options listed in fstab.

After that, you can see the structure, and then understand the parameters of each element.

  • Device.
  • Fstab folder mount point.
  • File system.
  • Settings.
  • Dump.
  • Revision.

Device Since everything is a file in Linux, fstab is no exception. This is a file that points to the physical device to be mounted and is located in the /dev directory, can be hd, sd, fd or others.

Assembly point and system

Assembly point is a directory that allows you to see and manage what the physical device contains.

File system interpretation algorithm
File system interpretation algorithm

File system, interpretation algorithm to be used to read data:

  1. EXT4 is the current Linux system with high performance and security.
  2. EXT3 is a Linux system that allows registration.
  3. EXT2 is an old Linux system that has no records and is hardly used anymore.
  4. NTFS - systemWindows used from NT to current 7.
  5. VFAT - Windows system used from 95, known as FAT32, also used in USB and useful for PC communication if both systems are installed.
  6. NFS is the system used by SUN or Solaris.
  7. ISO9660 is the system used on CDs and DVDs.
  8. JFS is an IBM file system that uses records.
  9. SWAP is the Exchange memory system used in Linux.
  10. XFS is the system used by Silicon Graphics.
  11. UFS is the system used by BSD.

Mount Options

Mount Options
Mount Options

Options are the options that will be used to mount the specified device.

Types of options:

  1. Async - asynchronous data writing.
  2. Sync - synchronous recording.
  3. Auto - will be installed automatically.
  4. Exec - has executable programs.
  5. Gid - specifies the group ID.
  6. Noauto - not mounted automatically, used on removable media.
  7. Nouser - mounts only root.
  8. Ro - read only.
  9. Rw - reading and writing.
  10. Suid - Allows the use of setuid bits, which are poorly managed and can compromise system security.
  11. Uid - sets filesystem user ID.
  12. Umask - allows you to place a mask so that other users cannot access the mounted system.
  13. Dump - the command that is used to create backups, can only be 0or 1 if it is zero, it does not backup, and if it is one, it is done using the dump command.
  14. Revision - a bit that allows you to determine whether this device will be revised or not during the creation of fsck; as in the previous option, 0 - does nothing, 1 - does.

Section identification

The advantage of using labels and UUIDs is that they are independent of the order in which devices are physically connected to the machine. This is useful if the user changes the BIOS storage order or connection scheme. There are three ways to identify a section:

  • by descriptive kernel name;
  • by label;
  • by UUID.

Sometimes it also happens that the BIOS changes the order of storage devices.

To show basic information about partitions, run the code:

$ lsblk –f.

Kernel name, Run lsblk -f, displays a list of partitions and sets the display name. Execute lsblk -f to display a list of partitions and place the display label.

Execute a command to display a list of partitions and put the display block ID number preceded by the UUID=prefix. If you only need to know the UUID of a specific partition, enter:

$ lsblk -no UUID /dev/sda2.

Partition identification
Partition identification

Building Systemd modules

Building on systems like RedHat relies on manipulating the /etc/fstab file. Version 7 of systemd shares the responsibility of build administration. To the user if he wants to manage buildswithout a threat to integrity, it is recommended to view the official documentation. The first thing to study is the systemd manual, as it refers to points more commonly known as mount units.

Mount point configured using single files and designated in /etc/fstab; there will be a dynamic conversion to points at system startup or dynamically when the system manager is loaded.

Installation blocks:

  1. What=(what) - absolute path to the device, file or other resource to mount.
  2. Where=(where) - absolute path to mount device, file or resource. It cannot be a symbolic link. If the assemblage point does not exist prior to the assembly, it is created at that point. It is important to know that this mount name must match the filename.
  3. Type=(type) - this option is not required, it just specifies the type of filesystem to be mounted.

There are other options that are worth exploring carefully if you need to manage precise mount points.

To see the unit files, use the find command and define location paths. Routes in systemd matter, in this case, it's the transformation. In other words, it generates files in the /run/systemd/generator path for configurations that are not native to systemd.

In order to understand the procedure, it is recommended to read the manual on the terminal:

man systemd-fstab-generatorman systemd.generator

Syntax for nfs

To collectNFS, on the server write /usr/local/pub/pub nfs rsize=8190, wsize=83000, timeo=16, intr

There are fstab mount options:

  1. Resize=n, the number of bytes used to read files on NFS. The default value is kernel dependent, currently the default is 1024 bytes. Performance increases significantly if you request rsize=8192.
  2. Wsize=n, the number of bytes used to write files. The default value depends on the kernel, currently it is 1024 bytes, performance is greatly improved by setting wsize=8192.
  3. Acregmin=n, the minimum time in seconds that the system will wait before updating the attributes of a regular file from the server. The default is 3 seconds.
  4. Acregmax=n, the maximum time in seconds the system can wait for a normal file's attributes to be updated from the server. The default value is 60 seconds.
  5. Acdirmin=n, the minimum time in seconds that the system will wait for the directory attributes to be updated from the server. The value is 30 seconds.
  6. Retry=n, tells how many times to retry NFS mount operation, default value is 10000 times.
  7. Nam n=n, option used when NFS server does not support version 2.
  8. RPC assembly protocol. This option can be used to specify a maximum length for filenames greater than the remote filesystem. It is used to support POSIX pathconf functions, the default value isis 255 characters.
  9. Port=n, the port number to use to connect to the NFS server if port is 0 by default. The system asks what port the remote machine's portmapper is using if the NFS machine is not registered with the portmapper.
  10. Mount port=n, numerical value of mountd port.
  11. Mount host=name, name of the machine running mountd.
  12. Mountprog=n, uses alternate RPC program number.

Tips & Tricks

Tips & Tricks
Tips & Tricks

If the user decides they no longer want to use the fstab configuration, they can perform a restore. To do this, open a terminal window and enter the following commands:

cd/etc/sudo rm fstabsudo cp/etc/backup/fstab/etc /.

Running these commands will remove the modified fstab file and put a copy of the backup file in its place. After that just restart the machine.

Before editing system files, make a backup copy. Nano will back up and automatically mount fstab.

To edit a file in Ubuntu run:

gksu gedit /etc/fstab.

To edit a file in Kubuntu run:

kdesu kate / etc / fstab.

To edit a file directly in the terminal run:

sudo nano -W /etc/fstab.

To view the contents of /etc/fstab, execute the following terminal command:

sudo -e /etc/fstab.

To get a list of all UUIDs, use one of the followingtwo teams:

sudo blkidls -l /dev/disk/by-uuid.

To list the drives and corresponding partitions that are connected to the system, run:

sudo fdisk -l.

To mount all filesystems in /etc/fstab run:

sudo mount -a.

Remember that the mount point must already exist, otherwise the entry will not be mounted on the file system. To create a new point, use root privileges to create the point, for example:

sudo mkdir /path/to/mountpointsudo mkdir /media/disk2.

One of the most common questions from GNU/Linux users is about automatic fstab cifs mounting, partition assembly and partition permissions. Assembly orders and their options are stored in /etc/fstab.

Normally when installing distributions such as Ubuntu, partition assembly lines are generated automatically in a general way. Fstab is not only Linux, the function works on different platforms.

Popular topic

Editor's choice

  • Restore Skype account: step by step instructions, return access to your account
    Restore Skype account: step by step instructions, return access to your account

    Don't know how to recover your Skype account? Or do you want to know your friend's Skype password? The article discusses several ways to restore the user's page, as well as recommendations for storing and selecting pin codes

  • Why can't I follow on Instagram? All possible reasons
    Why can't I follow on Instagram? All possible reasons

    We subscribe to people with a specific goal - to find friends, like-minded people of interest, to learn something new for ourselves. And sometimes it is very strange to see that the Instagram system does not allow you to "follow" the profile you are interested in. This error occurs quite often, no one is immune from this trouble. Let's analyze the main reasons why Instagram does not allow you to subscribe to people

  • How to find out who "liked" a person on Instagram. Proven Methods
    How to find out who "liked" a person on Instagram. Proven Methods

    Everyone who is trying to start the path of a blogger or has already achieved some success in this field, hopes that the content that he shares with readers will not be left without attention. The main indicator of page popularity is “likes”. “Thumbs up” is also put when they want to attract the attention of potential subscribers

  • How to restore a channel on YouTube: detailed instructions, simple and effective tips
    How to restore a channel on YouTube: detailed instructions, simple and effective tips

    This article describes how to restore a channel on YouTube after deleting it. To understand this task, it will be useful to familiarize yourself with some terminology. There is a difference between deleting and blocking a YouTube account

  • How to remove a contact from "Vatsap" and how to block an unwanted interlocutor
    How to remove a contact from "Vatsap" and how to block an unwanted interlocutor

    WhatsApp is a popular messenger. It has many features that users are not even aware of. One of these is the ability to block contacts. It helps to get rid of annoying interlocutors. And how to remove a contact from WhatsApp and how to block it? You can perform these actions in different ways