1,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.
2, some limitations of system mount
A, the root/must be mounted, and must be mounted before the other mount point.
B, the 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.
C, all mount point can be mounted only once at the same time.
D, all partition at the same time, can only be mounted once.
E, if you are removing, you must first move the working directory outside of Mount point (and its subdirectories).
3, each field of the file is explained
#NOTE: If your BOOT partition is ReiserFS, add the Notail option to opts.
< fs> |
<mountpoint> |
<type> |
<opts> |
<dump/pass> |
/dev/sda1 |
/boot |
Ext4 |
Noauto,noatime |
1 2 |
/dev/sda2 |
/ |
Ext4 |
Noatime |
0 1 |
/dev/sda3 |
None |
Swap |
Sw |
0 0 |
/dev/cdrom |
/mnt/cdrom |
Atuo |
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.
A,<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.
b,<mountpoint> mount point: Tell us where the device is mounted.
c,<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.
d,<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.
E,<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.
F,<pass> checks 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.
4,<opts> Common parameters
A,noatime off the Atime feature to improve performance, which is an old feature that can be safely turned off and also reduces loadcycle
B,defaults uses the default settings. Equal to Rw,suid,dev,exec,auto,nouser,async, the specific meaning of the following explanation.
C, automatic and manual mount:
D,auto automatically mounts when starting or entering mount-a in the terminal
E,noauto devices (partitions) can only be mounted manually
F, read and Write permissions:
RO mount as read-only permission
RW mount for Read and write permissions
G, 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!!!
H,I/O Sync:
Sync all I/O will be done in a synchronous manner
Async All I/O will be in asynchronous mode
I, user mount permission:
User allows any users to mount the device. implies Noexec,nosuid,nodev unless overridden.
Nouser only allows root users 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.
5, restart the system
Restart the system, or enter MOUNT-A in the terminal to see the modified effect.
Linux Configuration Boot mount: fstab file details