/Etc/fstab configuration file details

Source: Internet
Author: User
Etc/fstab is a text file in which each file system (including partitions or devices) is described in one row. in each row, fields are separated by spaces or tabs. lines starting with "*" in the file are comments. Sorting records in fstab files is very important. Because fsck, mount, umount, and other programs will Press

Etc/fstab is a text file in which each file system (including partitions or devices) is described in one row. in each row, fields are separated by spaces or tabs. lines starting with "*" in the file are comments. Sorting records in fstab files is very important. This is because programs such as fsck, mount, and umount perform their work in this order.

Example (sdb1 is the new hard disk ):

#/Etc/fstab: static file systeminformation.

#

#

Proc/proc defaults 0 0

/Dev/sda1/ext3 errors = remount-ro0 1

/Dev/sda6/home ext3 defaults 0 2

/Dev/sda5 none swap sw 0 0

/Dev/hdc/media/cdrom0 udf, iso9660user, noauto 0 0 0

/Dev/fd0/media/floppy0auto rw, user, noauto0 0

/Dev/sdb1/release El ext3 defaults 0 2

Column 1 and column 2: Devices and default mount points

Column 3: file system type

Column 4: Mount options (hard to understand)

Auto and noauto: This option controls whether devices are automatically mounted. Auto is the default option. in this way, the device is automatically mounted according to the fstab content when it is started or you use the mount-a command. If you do not want this, use the noauto option. in this case, you can only manually mount the device.

User and nouser: this is a very useful option. the user option allows common users to mount devices, while the nouser option only allows root users to mount devices. Nouser is the default option, which is also a headache for many new Linux users, because they find that there is no way to mount the optical drive and Windows partition normally. If you encounter similar problems or other problems as a common identity user, add the user attribute to fstab.

Exec and noexec: exec allow you to execute executable binary programs in the corresponding partition. Likewise, noexec has the opposite effect. If you have a partition and some executable programs on the partition, you can use the noexec attribute if you don't want them, or you cannot execute them in your system. This often happens when Windows partitions are mounted. Exec is the default option. The reason is very simple. if noexec becomes the default option for your/root partition ......

Ro: Mount the file system in read-only mode.

Rw: Mount the system with readable and writable attributes.

Sync and async: How should input and output of the file system be completed. Sync means that synchronization is completed. In other words, when you copy something to a device or partition, all write changes will take effect immediately after you enter the cp command, this should be copied to the device or partition immediately. If async is used, that is, asynchronous input and output, when you copy something to a device or partition, it may take a long time after you press the cp command, the actual write operation is executed. In other words, it is buffered.

Sometimes this mechanism is quite good, because sync will affect the running speed of your system, but it will also cause some problems. Think about it. when you want to copy a file to a USB flash drive, you execute the cp command, but forget to execute the umount command (it will forcibly write the buffer content ), the file you copied is not actually on the USB flash disk. If you are using the mv command, and you will soon unmount the USB flash disk ...... Congratulations, the file will disappear from this planet. Therefore, although async is the default attribute, it is recommended that you use the sync option for portable storage devices such as USB flash drives and mobile hard disks.

Defaults: use default configurations for all options, including rw, suid, dev, exec, auto, nouser, and async.

Generally, you can use ULTS directly without special requirements. After reading the introduction, let's go back and look at the content of the previous example. taking the optical drive as an example, we mainly focus on the mounting options here. we can see that the difference between the optical drive and other partition devices is ro, because the General Optical drive is read-only. Exec allows you to execute some programs directly from the optical drive.

Column 5 and column 6: dump and fsck options

The fifth column of fstab indicates the dump option. the dump tool determines whether the file system needs to be backed up by the number on the option location. If it is 0, dump will be ignored. In fact, most dump settings are 0. the sixth column is the fsck option. The fsck command checks this field to determine the sequence in which the file system scans and checks. The value of the root file system/pair should be 1, other file systems should be 2. if the file system does not need to scan and check at startup, set this field to 0.

Related Article

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.