Fstab File Description
The Fstab file contains information about the storage device and its file system on your computer. It is a file that determines how a hard disk (partition) is used or integrated into the entire system. Specifically: Using Fstab can automatically mount various file system formats of hard disk, partition, mobile devices and remote devices. For Windows and Linux dual OS users, you can share resources under Windows systems in Linux by mounting the FAT format and NTFS-formatted partitions with fstab.
The full path to this file is/etc/fstab. It's just a text file that you can open with your favorite editor, but it must be the root user to edit it. At the same time, fsck, Mount, Umount and other commands all use the program.
/etc/fstab is the configuration file at startup, however, the actual filesystem is recorded in the two files/etc/mtab and/proc/mounts. Each time we change the filesystem, we also change the two files.
Some limitations of the system mount:
- The root directory/must be mounted, and will have to be mounted before the other mount point.
- Other mount point must be a directory that has been created and can be arbitrarily specified, but must adhere to the required system directory schema principles
- All mount point can be mounted only once at the same time.
- All partition can only be mounted once within the same time.
- In the removal process, you must first move the working directory outside of Mount point (and its subdirectories).
Each field in the file is interpreted
Example:
# <fs> <mountpoint> <type> <opts> <dump/pass># NOTE: If your BOOT partition is ReiserFS, add the notail option to opts./dev/sda10 /boot ext4 noauto,noatime 1 2/dev/sda6 / ext4 noatime 0 1/dev/sda9 none swap sw 0 0/dev/cdrom /mnt/cdrom auto noauto,ro 0 0
In fact/etc/fstab (filesystem table) is when we mount with the Mount command, all the options and parameters are written to this file. In addition to this,/etc/fstab also added the support of dump for this backup command! It is related to commands such as the file system check fsck at startup.
- <file systems> Mount device: It is not a file system that we generally understand, but a device (hard disk and its partitions, DVD drives, etc.). It tells us the name of the device (partition), which is used when you mount (Mount), unload (Umount) devices on the command line.
- <mountpoint> mount point: Tell us where the device is mounted.
- <type> file system type: Linux supports many file systems. To get a complete support list look for Mount Man-page. Typical names include these: Ext2, ext3, ReiserFS, XFS, jfs,iso9660, VFAT, NTFS, swap and auto, ' Auto ' is not a file system, but the mount command automatically determines the file type, especially for removable devices, Floppy disk, DVD drive, it is necessary to do this because the file types may be mounted inconsistently each time.
- <opts> File System Parameters: This section is the most useful setting!!! It allows you to mount the device on the boot automatically loaded, so that the Chinese display does not appear garbled, restrict the mount partition read and write permissions. It is related to the use of the Mount command, and to get a complete list, refer to Mount Manpage.
- <dump> backup command: Dump utility is used to decide whether to do a backup. Dump checks the entry and uses the numbers to decide whether to back up the file system. The allowed numbers are 0 and 1. If it is 0,dump will ignore the file system, if it is 1,dump will make a backup. Most of the users are not installing dump, so for them <dump> this entry should be written as 0.
- <pass> whether to test the sector with fsck: During startup, the system defaults to fsck to verify that our filesystem is complete (clean). However, some filesystem do not need to be tested, such as memory replacement space (swap), or special file systems such as/proc and/sys, and so on. Fsck checks the numbers under the boss to determine the order of the file system, allowing the numbers to be 0, 1, and 2. 0 is not to test, 1 means the earliest test (usually only the root directory will be configured to 1), 2 is to be tested, but 1 will be more early test! In general, the root directory is configured to 1, and the other filesystem to be tested are configured to be 2.
<opts> Common parameters:
noatime
Turn off the Atime feature to improve performance, which is an old feature that can be safely turned off and also reduces loadcycle
defaults
Use the default settings. Equal to Rw,suid,dev,exec,auto,nouser,async, the specific meaning of the following explanation.
- Automatic and manual mounting:
auto
Mount automatically when Mount-a is started or entered in the terminal
noauto
Device (partition) can only be mounted manually
- Read and Write permissions:
ro
Mount as read-only permission
rw
Mount as read-write permission
- Executable:
exec
is a default setting that enables executable binaries in that partition to execute
noexec
Binary files are not allowed to execute. Never take this option in your root partition!!!
- I/O synchronization:
sync
All I/O will be synchronized
async
All I/O will be done in a non-synchronous manner
- User Mount Permissions:
user
Allows any user to mount the device. implies Noexec,nosuid,nodev unless overridden.
nouser
Only the root user is allowed to mount. This is the default setting.
- Temporary File Execution permissions:
suid
Permit the operation of Suid, and sgid bits. They is mostly used to allow users in a computer system to execute binary executables with temporarily elevated privilege s in order to perform a specific task.
nosuid
Blocks the operation of Suid, and sgid bits.
Rebooting the system
Restart the system, or enter it in the terminal mount -a
to see the modified effect.
Configure boot mount: fstab file details