Linux/etc/fstab file, linuxetcfstab File

Source: Internet
Author: User

Linux/etc/fstab file, linuxetcfstab File
I. Role

/Etc/fstab is a file used to store the static information of the file system. When the system starts, the system automatically reads information from the file, the specified file system in the file is automatically mounted to the directory where the file is executed.

Ii. Mount restrictions


1. The root directory must be mounted and mounted prior to other mount points. Because mount is the root directory of all directories, other directories are derived from the root directory /.
2. the mount point can be specified arbitrarily, but the system directory architecture principles must be observed.
3. the mount point must be an existing Directory.
4. All mount points can only be mounted once at the same time
5. All partitions can only be attached once at the same time.
6. If you detach a file, you must remove the working directory from the mount point (and its subdirectories ).

3. Parameters in the/etc/fstab file

Cat/etc/fstab
[Root @ server ~] # Cat/etc/fstab

#
#/Etc/fstab
# Created by anaconda on Fri mar24 19:30:39 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab (5), findfs (8), mount (8) and/or blkid (8) for more info
#
UUID = fd93d9dc-e277-4926-8a83-c731b5600f8b/ext4 ults 1 1
UUID = c9517f8f-081d-444f-8510-92d236671b37/boot ext4 ults 1 2
UUID = bd841c60-daf5-4c5d-8392-95d4e8b9f4e7/opt ext4 ults 1 2
UUID = fe6dd69c-99f4-478d-acc7-ef7e156e5bc5/usr/local ext4 ults 1 2
UUID = 1e71b8a2-bb4e-4e39-a894-e04fb6480e2e swap defaults 0 0
Tmpfs/dev/shm tmpfs defaults 0 0
Devpts/dev/pts devpts gid = 5, mode = 620 0 0
Sysfs/sys sysfs defaults 0 0
Proc/proc defaults 0 0

Column 1: Device: disk Device file, Device Label, or UUID

The first field, (fs_spec), describes the block special device or remote filesystem to be mounted.
1). view the label and uuid of the partition.
The Label is the partition Label, and the mount point filled in when the system was initially installed is the Label Name. You can find the UUID and Label Name by viewing the information in the superblock of a partition.
For example, to view the uuid and label name of the/dev/sda1 Device
Command 1: dumpe2fs-h/dev/sda1
[Root @ server ~] # Dumpe2fs-h/dev/sda1
Dumpe2fs 1.41.12 (17-May-2010)
Filesystem volume name: <none>
Last mounted on:/boot ----> This is the Label name.
Filesystem UUID: c9517f8f-081d-444f-8510-92d236671b37 ----> UUID
Filesystem magic number: 0xEF53

Command 2: blkid
[Root @ server ~] # Blkid
/Dev/sda1: UUID = "c9517f8f-081d-444f-8510-92d236671b37" TYPE = "ext4"
/Dev/sda2: UUID = "1e71b8a2-bb4e-4e39-a894-e04fb6480e2e" TYPE = "swap"
2) the device name and label and uuid are used as different identifiers.
The device name (/dev/sda) is fixed when the partition is mounted. Once the slot order of the disk changes, the name mismatch may occur. Because the name will change.
However, you do not need to worry about the Slot Sequence when using label mounting. However, pay attention to the label name at any time. As for the uuid, after each partition is formatted, a UUID will be used as a unique identifier. Use UUID as the unique ID number. If you use UUID for mounting, you do not have to worry about confusion.

Column 2: Mount point: the Mount point of the device, which is the directory to which the device is mounted.
The second field, (fs_file), describes the mount point for the filesystem. for swap partitions, this field shocould be specified as 'none '. if the name of the mount point contains spaces these can be escaped as '\ 040 '.


Column 3: filesystem: Format of the Disk File System,Supports many different file systems: ext2, ext3, ext4, reiserfs, xfs, jfs, smbfs, iso9660, vfat, swap, and auto. Set it to auto type, the mount command guesses the file system type used, which is very useful for mobile devices such as CDROM and DVDs.

The third field, (fs_vfstype), describes the type of the filesystem. linux supports lots of filesystem types, such as adfs, affs, autofs, coda, coherent, cramfs, devpts, efs, ext2, ext3, hfs, hpfs, iso9660, jfs, minix, msdos, ncpfs, nfs, ntfs, proc, qnx4, reiserfs, romfs, smbfs, sysv, tmpfs, udf, ufs, umsdos, vfat, xenix, xfs, and possibly others. for more details, see mount (8 ). for the filesystems currently supported by the running kernel, see/proc/filesystems. an entry swap denotes a file or partition to be used for swapping, cf. swapon (8 ). an entry ignore causes the line to be ignored. this is useful to show disk partitions which are currently unused. an entry none is useful for bind or move mounts.

Column 4: parameters: File System parameters

The fourth field, (fs_mntops), describes the mount options associated with the filesystem.

Parameters Description
Auto Automatic mounting when the mount-a command is started or typed
Noauto Only mounted under commands
Exec Binary files allowed to execute this partition
Noexec Execution of binary files on this file system is not allowed
Ro Mount a file system in read-only mode
Rw Mount a file system in read/write mode
User Allows any user to mount the file system. If no definition is displayed, the noexec, nosuid, and nodev parameters are implicitly enabled.
Users Allow all users in the users Group to mount the file system.
Nouser Can only be mounted by root
Owner Allow the device owner to mount
Sync I/0 Synchronization
Async I/O asynchronous
Dev Do not parse block special devices on the file system
Suid Allows suid operations and setting sgid bits. this parameter is usually used for some reshuffle tasks, so that the general user can improve the permissions when running the program.
Nosuid Disable suid operation and set sgid bit
Noatime Not updating inode access records on the file system can improve performance
Nodiratime Do not update inode access records of directories on the file system
Relatime Update the inode access record in real time. The inode access record is updated only when the access time in the record is earlier than the current access time (similar to noatime, but will not interrupt processes such as mutt or other programs to detect whether files have been modified after the last access)
Flush-vfat options Frequently refresh data. The copy dialog box or progress bar disappears after all data is written.
Ults Use the default mount parameters of the file system. For example, the default parameters of ext4 are rw, suid, dev, exec, auto, nouser, and async.



Column 5: whether the command can be backed up by dump: dump is a backup command. Generally, the value of this parameter is 0 or 1.

The specified th field, (fs_freq), is used for these filesystems by the dump (8) command to determine which filesystems need to be dumped. if the specified th field is not present, a value of zero is returned and dump will assume that the filesystem does not need to be dumped.

Value Description
0 Do not perform dump backup
1 Indicates the daily dump operation.
2 Dump operations with an indefinite date



Column 6: whether to check the sector: During the boot process, the system uses fsck to check whether our system is complete (clean) by default)

The sixth field, (fs_passno), is used by the fsck (8) program to determine the order in which filesystem checks are done at reboot time. the root filesystem shoshould be specified with a fs_passno of 1, and other filesystems shoshould have a fs_passno of 2. filesystems within a drive will be checked sequentially, but filesystems on different drives will be checked at the same time to utilize parallelism available in the hardware. if the sixth field is not present or zero, a value of zero is returned and fsck will assume that the filesystem does not need to be checked.

Value Description
0 Do not test
1 Earliest test (usually selected in the root directory)
2 1 level inspection after completion



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.