Fstab File settings

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. At the same time, fsck, mount, umount and other commands are used

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 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. 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/hdXN, 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 ULTS 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 root file system/pair 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 00

/Dev/hda7/winf vfat defaults, codepage = 936, iocharset = cp936 00

/Dev/hdb/cdrom iso9660 noauto, user 0 0

None/proc defaults 0 0

None/dev/pts devpts gid = 5, mode = 620 0 0

Fstab stores important information related to partitions. each row is a partition record, and each row can be divided into six parts, the following uses/dev/hda7/ext2defaults 1 as an example to describe one by one:

1. The first is the physical location of the storage device you want to mount, such as hdb or/dev/hda6.

2. the second item is the directory to which you want to add it, such as/home or/. this is the mount point prompted during installation.

3. the third item is the so-called localfilesystem, which contains the following formats: ext, ext2, msdos, iso9660, nfs, swap, etc., or ext2. for details, see/prco/filesystems.

4. the fourth item is the status you want to set during mount, such as ro (read-only) or ULTS (including other parameters such as rw, suid, exec, auto, nouser, and async ), see "mountnfs 」.

5. the fifth item is to provide the DUMP function. it indicates whether the BACKUP flag is required during system DUMP. The value is 0.

6. the sixth item is to set whether the filesystem needs to perform the check action at startup. except for the root filesystem, the required check value is 1. the other items can be set as needed. the internal value is 0.

/Etc/fstab mainly includes six items:

For example, print the content of the two middle lines, as shown below:
LABEL = // ext3 defaults 1 1
/Dev/sda2/mnt/D/vfat defaults 0 0

Column 1: Device name or device volume name (/dev/sda10 or LABEL = /)

Column 2: Device Mount Directory (for example, the above "/" or "/mnt/D /")

Column 3: device file system (for example, the above "ext3" or "vfat ")

Column 4: mount parameters (see help man mount)
For a mounted device, such as the/dev/sda2 above, you need to change the Mount parameter. you do not need to uninstall the device, but you can use the following command (no mounted device, the remount parameter is invalid)
# Mount/mnt/D/-o remount, ro (change defaults to ro)
To ensure security, you can specify other mount parameters, such:
Noexec, at this time, we only need to re-build the system!
Nodev (device files cannot be mounted)
Nosuid and nosgid (suid and sgid attributes are not allowed)
Nouser)

Column 5: indicates whether to back up data. (0 indicates no backup, 1 indicates backup, and generally the root partition must be backed up)

Column 6: indicates the self-check sequence. (0 indicates no self-check. 1 or 2 indicates self-check. if the root partition is set to 1, other partitions can only be 2)

If you want to enable automatic mount, you can add the following lines on/etc/fstab:
/Dev/hda5/mnt/d vfatexec, dev, suid, rw, umask = 0, iocharset = gb2312, codepage = 936 0 0
It also solves the problem of garbled characters in Chinese file names. my fstab file is as follows for your reference only:
LABEL =/12/ext3 defaults 1 1
None/dev/pts devpts gid = 5, mode = 620 0 0
None/proc defaults 0 0
None/dev/shm tmpfs defaults 0 0
/Dev/hda4 swap defaults 0 0
/Dev/cdrom/mnt/cdrom iso9660 noauto, owner, kudzu, ro 0 0
/Dev/fd0/mnt/floppy auto noauto, owner, kudzu 0 0
/Dev/hda1/mnt/c vfatexec, dev, suid, rw, umask = 0, iocharset = gb2312, codepage = 936 0 0
/Dev/hda5/mnt/d vfatexec, dev, suid, rw, umask = 0, iocharset = gb2312, codepage = 936 0 0
/Dev/hda6/mnt/e vfatexec, dev, suid, rw, umask = 0, iocharset = gb2312, codepage = 936 0 0
/Dev/hda7/mnt/f vfatexec, dev, suid, rw, umask = 0, iocharset = gb2312, codepage = 936 0 0
/Dev/hda8/mnt/g vfatexec, dev, suid, rw, umask = 0, iocharset = gb2312, codepage = 936 0 0

Fstab interpretation

To the right:
/Dev/device mount-point type rules dump fsck
1./dev/device: Needless to say, right? For example,/dev/hda1 is a c: disk under M $-Win9x.
2. mount-point: mount point. For example, Mount/dev/hda1 to/mnt/mywinc.
3. type: ext3, vfat,... is the type of the file system to be mounted.
4. rules:
Auto: Automatic mounting upon startup;
Default, noauto: The device is not automatically mounted upon startup;
Nouser: Only root users can be mounted;
Ro: Read-only mounting;
Rw: readable and writable;
User: any user can be attached;
5. dump: backup; 0 indicates never backup, or the number of days since the last backup is displayed;
6. fsck: fsck check sequence at startup. if the value is 0, no check is performed, and "/" is always 1;
Mine is:
/Dev/hda1/mnt/mywinc vfat default 0 0

Load partitions in fstab

Mkdir/mnt/win_c
Vi/etc/fstab
:::: Add :::::
/Dev/hda1/mnt/win_c vfat default, pagecode = 936, iocharset = cp936 00

/Etc/fastab

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 IDE device channel (a, B, orc). 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' for definition.
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.
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/hda9 swap defaults 0 0
/Dev/hda1/ext2 defaults 1 1
/Dev/hda5/home ext2 defaults 1 1
/Dev/hda6/usr ext2 defaults 1 1
/Dev/hda7/usr/local ext2 defaults 1 1
/Dev/hda8/var ext2 defaults 1 1
/Dev/hdb/cdrom iso9660 noauto, user 0 0
None/proc defaults 0 0
None/dev/pts devpts gid = 5, mode = 620 0 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.