Fstab Document Detailed

Source: Internet
Author: User
Fstab Document Detailed
Note: The iocharset=cp936 of sled is Iocharset=utf8
1 function of the Fstab file

File/etc/fstab Store file system information in the system. When the file is set correctly, you can load a file system with the Mount/directoryname command, each file system corresponds to a separate row, and the fields in each row are separated by spaces or tab keys. At the same time, fsck, Mount, Umount and other commands are used in this program.

2. fstab file format

The following is an example of a/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 you want to load is located, and for a typical local block device scenario: The IDE device is generally described as/dev/hdaxn,x is the IDE device channel (A, B, or C), n represents the partition number, and SCSI device one is described as/ Dev/sdaxn. For NFS cases, the format is generally:

, such as: ' knuth.aeb.nl:/. For PROCFS, use ' proc ' to define.

Fs_file-This field describes the directory points that you want the filesystem to load, none for swap devices, and 40来 for spaces that contain spaces for the loaded directory name.

Fs_type-Defines the file system on the device, typically common file types are ext2 (common file types for Linux devices), VFAT (FAT32 format for Windows systems), NTFS, iso9600, and so on.

CodePage National Language code page

Iocharset Character Set

Fs_options-Specifies that the file system that loads the device is a specific parameter option that needs to be used, and that multiple parameters are separated by commas. For most systems, defaults can be used to meet the needs. Other common options include the following:

Option meaning

Ro loads the file system in read-only mode

Sync does not buffer the write operations of the device, which prevents the file system from being corrupted during an abnormal shutdown, but reduces the computer's speed

User allows normal users to load the file system

Quota enforces disk quota limits on this filesystem

Noauto no longer uses the MOUNT-A command (for example, when the system starts) to load the file system

Fs_dump-This option is used by the dump command to check how quickly a file system should be dumped, and set this field to 0 if no dump is required

Fs_pass-This field is used by the fsck command to determine the sequence of file systems that need to be scanned at startup, the value of the root file system/pair should be 1, and the other file system should be 2. Set this field to 0 if the file system does not need to be scanned at boot time

 

3. Sample Files

#/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 proc Defaults 0 0

None/dev/pts devpts gid=5,mode=620 0 0 fstab contains important information about the partition, each of which has a partition record, each row can be divided into six parts, and the following/DEV/HDA7/EXT2 defaults 1 1 is Examples are explained individually:

1. The first item is the physical location of the storage unit you want to mount, such as HDB or/DEV/HDA6.

2. The second item is where you want to add it to the directory location, such as/home or/, which is actually the mount point that is prompted at installation time.

3. The third item is the so-called local filesystem, which includes the following formats: ext, ext2, MSDOS, iso9660, NFS, swap, or, for example, Ext2, can refer to the/prco/filesystems description.

4. The fourth item is the state you want to set when you mount, such as RO (read-only) or defaults (including other parameters such as RW, suid, exec, auto, nouser, async), which you can see "mount nfs".

5. The fifth is to provide the dump function, in the system dump when the need for backup logo bit, the value is 0.

6. The sixth is to set whether this filesystem to do check on the boot, in addition to the root of the filesystem its necessary check to 1, all other visual needs to set, the default value is 0. The main contents of/etc/fstab include six items:

For example: Print out two lines of content in the middle, as follows
label=//ext3 Defaults 1 1
/dev/sda2/mnt/d/VFAT Defaults 0 0

First column: Device name or device label name, (/DEV/SDA10 or label=/)

Second column: Device mount directory (e.g. above "/" or "/mnt/d/")

Third column: Device file system (for example, "ext3" or "VFAT" above)

Column Fourth: Mounting parameters (see Help man Mount)
For devices that have been mounted, such as the/dev/sda2 above, now to change the mount parameter, you can use the following command (without the mounted device, remount this parameter) without uninstalling the device.
#mount/mnt/d/-o remount,ro (defaults to RO)
For security reasons, you can specify additional mount parameters, such as:
Noexec (executable executable is not allowed, but do not hang the root partition as NOEXEC, then you can not use the system, even the mount command can not be used, then only to redo the system.)
Nodev (not allowed to mount device files)
Nosuid,nosgid (SUID and Sgid attributes are not allowed)
Nouser (do not allow normal user to mount)

Column Fifth: Indicates whether to back up, (0 is not backed up, 1 is to be backed up, the general root partition to back up)

Sixth column: Indicates the order of self test. (0 for not self-test, 1 or 2 for self-test, if the root partition is set to 1, other partitions can only be 2) if you want to boot on the mount, you can add the following lines on the/etc/fstab:
/dev/hda5/mnt/d vfat exec,dev,suid,rw,umask=0,iocharset=gb2312,codepage=936 0 0
At the same time also resolved the Chinese file name garbled problem, my fstab file is as follows, for reference only:
LABEL=/12/EXT3 Defaults 1 1
None/dev/pts devpts gid=5,mode=620 0 0
NONE/PROC 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 vfat exec,dev,suid,rw,umask=0,iocharset=gb2312,codepage=936 0 0
/dev/hda5/mnt/d vfat exec,dev,suid,rw,umask=0,iocharset=gb2312,codepage=936 0 0
/dev/hda6/mnt/e vfat exec,dev,suid,rw,umask=0,iocharset=gb2312,codepage=936 0 0
/dev/hda7/mnt/f vfat exec,dev,suid,rw,umask=0,iocharset=gb2312,codepage=936 0 0
/dev/hda8/mnt/g vfat exec,dev,suid,rw,umask=0,iocharset=gb2312,codepage=936 0 0

Fstab interpretation

From doing right:
/dev/device mount-point type rules dump fsck
1./dev/device: Needless to say. For example,/DEV/HDA1 is a C: disk under M$-win9x.
2. Mount-point: Mount point. For example, hang the/dev/hda1 under/mnt/mywinc.
3. Type:ext3, VFAT, ... Is the type of file system to hang.
4. Rules:
Auto: Post automatic hook up;
Default, Noauto: Power-on does not automatically hook up;
Nouser: Only root can be hung;
RO: Read-only hook;
RW: readable and writable hooks;
User: Any users can hook up;
5. Dump: Backup, 0 is never back up, or show the last date of the backup days;
6. fsck: The fsck Check order is started, 0 is not checked, "/" is always 1;
Mine is:
/dev/hda1/mnt/mywinc vfat default 0 0

Loading partitions in Fstab

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

/etc/fastab and doubts

1. Role of the Fstab document
File/etc/fstab Store file system information in the system. When the file is set correctly, you can load a file system with the "mount/directoryname" command, each file system corresponds to a separate row, and the fields in each row are separated by spaces or tab keys. At the same time, fsck, Mount, Umount and other commands are used in this program.
2. fstab file format
The following is an example of a/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 you want to load is located, and for a typical local block device scenario: The IDE device is generally described as/dev/hdaxn,x is the IDE device channel (A, B, or C), n represents the partition number, and SCSI device one is described as/ Dev/sdaxn. For NFS, the format is generally Fs_file-This field describes the directory points that you want the filesystem to load, none for swap devices, and 40来 for spaces that contain spaces for the loaded directory name.
Fs_type-Defines the file system on the device, typically common file types are ext2 (common file types for Linux devices), VFAT (FAT32 format for Windows systems), NTFS, iso9600, and so on.
Fs_options-Specifies that the file system that loads the device is a specific parameter option that needs to be used, and that multiple parameters are separated by commas. For most systems, "defaults" can be used to meet your needs. Other common options include the following:
Option meaning
Ro loads the file system in read-only mode
Sync does not buffer the write operations of the device, which prevents the file system from being corrupted during an abnormal shutdown, but reduces the computer's speed
User allows normal users to load the file system
Quota enforces disk quota limits on this filesystem
Noauto no longer uses the MOUNT-A command (for example, when the system starts) to load the file system
Fs_dump-This option is used by the "Dump" command to check how quickly a file system should be dumped, and set this field to 0 if no dump is required
Fs_pass-This field is used by the fsck command to determine the sequence of file systems that need to be scanned at startup, the root file system "/" should have a value of 1 for the field, and the other file system should be 2. Set this field to 0 if the file system does not need to be scanned at boot time
3. Sample Files
#/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 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.