Usage of/etc/fstab in linux

Source: Internet
Author: User
1fstab files/etc/fstab files store the file system information in the system. When the file is correctly set, you can use the mount/directoryname command to load a file system. each file system corresponds to an independent line, fields in each row are separated by spaces or tabs. Both fsck and mou

1. functions of the fstab file

File/etc/fstab stores the file system information in the system. When the file is correctly set, you can run the "mount/directoryname" command to load a file system. each file system corresponds to an independent line, fields in each row are separated by spaces or tabs. At the same time, fsck, mount, umount and other commands all use this program.

2. fstab file format

The following is an example line of the/etc/fatab file:
Fs_spec fs_file fs_type fs_options fs_dump fs_pass
/Dev/hda1/ext2 defaults 1 1

Fs_spec-this field defines the device or remote file system where the file system to be loaded is located. for general local block devices, the IDE device is generally described as/dev/hdaXN, X is the channel (a, B, or c) of the IDE device. N represents the partition number. SCSI device 1 is described as/dev/sdaXN. For NFS, the format is generally:

For example, 'knuth. aeb. nl :/. For procfs, use 'proc to define.

Fs_file-this field describes the directory point to be loaded by the file system. for a swap device, this field is none. for a directory name containing spaces, 40 is used to indicate spaces.

Fs_type-defines the file system on the device. the common file types are ext2 (common file types for Linux devices) and vfat (fat32 format for Windows systems), NTFS, iso9600, etc.

Codepage country code page

Iocharset character set

Fs_options-specifying the file system to load the device is a specific parameter option that needs to be used, multiple parameters are separated by commas. Most systems can use "defaults" to meet their needs. Other common options include:
Option description
Ro loads the file system in read-only mode
Sync does not buffer write operations on the device, which can prevent file system damage during abnormal shutdown, but reduces the computer speed.
User allows normal users to load the file system
Quota forces disk quota limit on this file system
Noauto no longer uses the mount-a command (for example, when the system is started) to load the file system

Fs_dump-This option is used by the "dump" command to check how often a file system should be dumped. If no dump is required, set this field to 0.

Fs_pass-this field is used by the fsck command to determine the sequence of the file system to be scanned at startup. The value of the "/" pair of the root file system should be 1, other file systems should be 2. If the file system does not need to scan at startup, set this field to 0.


3. Sample file

#/Etc/fstab
/Dev/hda8 swap defaults 0 0
/Dev/hda9/ext2 defaults 1 1
/Dev/hda6/wine vfat defaults, codepage = 936, iocharset = cp936 0 0
/Dev/hda7/winf vfat defaults, codepage = 936, iocharset = cp936 0 0
/Dev/hdb/cdrom iso9660 noauto, user 0 0
None/proc defaults 0 0
None/dev/pts devpts gid = 5, mode = 620 0 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.