Fstab mount options: definition, types, formats, tips and tricks for work

Fstab is valid for any Linux OS: Debian, Mandrake, Mandriva and Suse and others. The function contains data on fstab mount options in file systems, where and with what options to combine them. For NFS, it contains the server name and the 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.

Knowledge and features of FSTAB

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

fdisk / dev / sda.

Using fdisk, you can handle partitions in a flexible and safe way. By introducing p, a list of partitions appears. For instance.

Fstab mount option

After identification, the fstab mount option is used. The structure of this file uses special syntax. Lines consist of six separated fields with their own meaning: space, tab or combination.

Rows consist of six split fields.

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

Man pages option

Man pages option

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

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

Similar to the previous parameter, Gid belongs to a group of users. You can see the gid group in / etc / groups. Fmask is the umask for the partition to be mounted. Thus, you can specify the permissions that they will have. Since the data section belongs to the user, he is given the same permissions as for home by default, readable and writeable for the owner specified in uid for reading to users of the same group specified in the git file.

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

Mount order

Mount order

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

$ sudo umount –a.

In order to parse the device that is being used, they check which process does this using the fuse instruction and the section descriptor as follows:

$ sudo fuse -m / dev / sda3.

The instruction will show the PID of the processes that occupy the section. You can perform its destruction, disassembly and reassembly using:

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

Go to the section and check the permissions using a ls. After this process, files with the same resolution as Home will be mounted so that they are integrated.

Fstab auto function

Fstab auto function

The file / etc / fstab is used to install the cifs fstab mount scheme and integrate partitions, various block devices, or remote files described on a separate line into the system. These definitions are converted using systemd to dynamic compiled modules at startup and after a reboot of the configuration 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. The installation parameters listed in fstab apply.

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

  • Device.
  • Fstab mount point of the folder.
  • File system.
  • Parameters.
  • Dump
  • Audit.

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

Assembly point and system

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

File System Interpretation Algorithm

File system, interpretation algorithm that will 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 you to register.
  3. EXT2 is an old Linux system that has no records and is almost never used.
  4. NTFS - Windows system used from NT to current 7.
  5. VFAT is a Windows system used from 95, known as FAT32, also used in USB and useful for exchanging data on a PC if both systems are installed on it.
  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 by Linux.
  10. XFS is the system used by Silicon Graphics.
  11. UFS is the system used by BSD.

Mount options

Mount options

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

Types of options:

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

Partition 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 storage order in the BIOS or the connection scheme. There are three ways to identify a section:

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

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

In order to show basic information about partitions, run the code:

$ lsblk –f.

The kernel name, Run lsblk –f, displays a list of partitions and sets the display name. Run lsblk –f to display the list of partitions and place the displayed label.

Execute the command to show the list of sections and place the identifier number of the displayed block, preceded by the prefix UUID =. If you need to know only the UUID of a particular section, enter:

$ lsblk -no UUID / dev / sda2.

Partition Identification

Building Systemd Modules

Build on systems like RedHat is based on manipulating the / etc / fstab file. Version 7 of systemd shares the responsibility of the assembly administration. The user, if he wants to manage assemblies without compromising integrity, is recommended to view official documentation. The first thing to learn is the systemd manual, as it refers to points better known as mount units.

The mount point is configured using single files and is indicated in the / etc / fstab file; there will be dynamic conversion to points at system startup or dynamically when loading the system manager.

Installation Blocks:

  1. What = (what) - the absolute path to the device, file or other resource to mount.
  2. Where = (where) - an absolute route for mounting a device, file or resource. This cannot be a symbolic link. If the assembly point does not exist before the assembly, it is created at this point. It is important to know that this mount name must match the file name.
  3. Type = (type) - the option is optional, it simply indicates the type of file system that will be mounted.

There are other options that recommend careful study if you need to manage the exact mount points.

In order to see unit files, use the find command and determine the location routes. Routes in systemd matter, in this case, this conversion. In other words, it generates files in the / run / systemd / generator path for those 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

In order to build NFS, on the server register / usr / local / pub / pub nfs rsize = 8190, wsize = 83000, timeo = 16, intr

There are mount options for fstab:

  1. Resize = n, the number of bytes that are used to read files on NFS. The default value depends on the kernel; currently, by default it is 1024 bytes. Performance increases significantly if you request rsize = 8192.
  2. Wsize = n, the number of bytes that are used to write files. The default value depends on the kernel, currently it is 1024 bytes, the performance is significantly increased by setting wsize = 8192.
  3. Acregmin = n, the minimum time in seconds that the system will wait until the attributes of a regular file are updated from the server. By default, it is 3 seconds.
  4. Acregmax = n, the maximum time in seconds during which the system can wait for the attributes of a regular file to be updated from the server. The default value is 60 seconds.
  5. Acdirmin = n, the minimum time in seconds during which the system will wait for the directory attributes to be updated from the server. The value is 30 seconds.
  6. Retry = n, indicates how many times to repeat the NFS mount operation, the default value is 10,000 times.
  7. Nam n = n, the option is used when the NFS server does not support version 2.
  8. RPC build protocol. This option can be used to specify the maximum length of file names, greater than that of the remote file system. It is used to support POSIX pathconf functions; the default value is 255 characters.
  9. Port = n, the port number that should be used to connect to the NFS server if the port is 0 by default. The system asks which port portmapper the remote computer is using if the NFS machine is not registered with portmapper.
  10. Mount port = n, numeric value of mountd port.
  11. Mount host = name, the name of the machine on which mountd is running.
  12. Mountprog = n, uses an alternative RPC program number.

Tips & Tricks

Tips & Tricks

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

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

Executing these commands will delete the modified fstab file and put a copy of the backup file in its place. After that, they simply restart the machine.

Before editing system files, perform a backup. 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 the 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 the UUIDs, use one of the following two commands:

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

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

sudo fdisk -l.

To mount all file systems in / etc / fstab, run:

sudo mount -a.

It must be remembered that the mount point must already exist, otherwise the record 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 for GNU / Linux users is to automatically mount fstab cifs, build partitions, and their permissions. Assembly orders and their options are stored in the / etc / fstab file.

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

Source: https://habr.com/ru/post/C12093/


All Articles