/Etc/fstab network 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. 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 system information. # <file system> <mount point> <type> <options> <dump> <pass> proc/procprocdefaults00/dev/sda1/ext3errors = remount-ro 01/dev/sda6 /homeext3defaults02/dev/sda5noneswapsw00/dev/hdc/media/cdrom0udf, iso9660 user, noauto00/dev/fd0/media/floppy0 autorw, user, noauto 00/dev/sdb1/cancelext3defaults02 column 1 and Column 2: Device and default mount point Column 3: file System Type Column 4: Mount Option (hard to understand) auto and noauto: This is the control setting Whether to enable automatic mounting. 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 defaults 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: The fifth column of the dump and fsck options fstab indicates the dump option. The dump tool determines whether the file system needs to be backed up by a 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.

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.