/Etc/fstab file analysis (version 2), etcfstab

Source: Internet
Author: User

/Etc/fstab file analysis (version 2), etcfstab
/Etc/fstab file Analysis

 

As mentioned above, the new partition will expire after the system is restarted. To take effect permanently, you need to write it to the/etc/fstab file.

 

I./etc/fstab file format: 6 components

 

Physical partition name/volume label mount point file system default settings check Sequence

UUID = 6e428a.../ext4 defaults 1 1

LABEL = // ext4 defaults 1/0 0/1/2

/Dev/sda1

 

2. Write partition information to/etc/fstab

/Dev/sdb1/testext4defaults1 [Detection If Data Partition is used] 2 [detection order ratio/back]

In this way, the partition is automatically mounted when the system starts and does not need to be manually mounted.

 

Iii. Marking

E2label/dev/sda1 // query the volume label

E2label/dev/sdb2 apache // set the volume label

In this case, you can write it to the/etc/fstab file: Change/dev/sdb1 In the first line to LABEL = apache, which has the same effect [However, it has been proved by experiments that, in CentOS 6.4, the scalping method is not supported. Remember]

 

4. added the swap Partition Function for SWAPFILE

Scenario: there is no new hard disk, but you still need to increase the space of the swap partition...

 

1. mkdir/var/swap

Chmod 700/var/swap // create a directory for storing swap virtual swap space

 

2. dd if =/dev/zero of =/var/swap/file. swp bs = 1024 k count = 10

 

Bs [block size] # specify the file block size. UNIX does not support k.

Count # specify the file. swp file size in bs.

 

Then: dd if =/dev/zero of =/var/swap/file. swp bs = 1024 k count = 10 # specify/var/swap/file. the size of the swp file is 10 MB, and the size of all the file content is 0.

 

[Use this command to create a very large file to test the read/write speed of the disk and test whether the disk is full]

 

3. mkswap/var/swap/file. swp # create a swap space

4. swapon/var/swap/file. swp # enable the newly created swap space

Swapoff/var/swap/file. swp # disable the swap space]

 

5. Write the swap space to the/etc/swaptab file. The swap space is automatically loaded every time the system starts.

/Var/swap/file. swp swap defaults 0 0

 

Attachment-disk Copy command

Dd if =/dev/sda of =/dev/sdb realize Disk/dev/sda and/dev/sdb copying

 

Appendix-free view memory information

Free-m #-m is displayed in MB, and-g is displayed in g.

 

Appendix-two pseudo devices in Linux

/Dev/zero: input 0 to the file.

/Dev/null File black hole


A line of LINUX information in A/etc/fstab file is as follows:

In linux, the mount command is often used to mount a hard disk partition or a CD to a file system.

/Etc/fstab is the file system automatically mounted to linux during boot.

In linux, the data items of/etc/fstab are as follows:

/Dev/device mountpoint type rules 0 order

For example, this is a common/etc/fstab:

/Dev/hda2/ext3 defaults 0 1

/Dev/hda3 swap defaults 0 0

/Dev/hda5/usr ext3 defaults 0 0

/Dev/fdo/mnt/flopy ext3 noauto 0 0

/Dev/cdrom/mnt/cdrom iso9660 noauto, ro 0 0

/Dev/device is the device to be mounted, And/hda2 is the second partition of the primary hard disk on the first IDE slot. If it is the third partition of the primary hard disk of the second IDE slot, It is/dev/hdc3. You can use fdisk-l in linux to view details.

Mountpoint is the mount point. //,/Usr, and swap are default mount points in the system installation time zone.

If you want to mount a new device, you should think about it, because the new device will be a permanent part of the file system, according to FSSTND (File System Standard) and its role, user needs. For example, if you want to use it as a shared resource, put it under/home is a good choice.

Type refers to the file system category.

Rules refers to the rules for mounting. Below are several common examples:

Auto mount

Default sets the Mount definition according to the default values of most permanent file systems.

Noauto is not automatically mounted upon startup

Nouser can be mounted only by Super Users.

Ro mounting by read-only permission

Rw mount by read/write permission

User any user can mount

Note that the optical drive and soft drive can be mounted only when the media is installed, so it is noauto

0 refers to dump (system backup tool ). If this parameter is set to 0, no backup is performed. If the last dump backup was used, the number of days since the backup is displayed.

Order refers to the order in which fsck checks are performed at startup ). If the value is 0, no check is performed. (/) partitions are always

Yes 1. Other partitions can only start with 2. When the numbers are the same, check at the same time (but there cannot be two 1 ).

If I want to mount windows C on the primary hard drive of the second IDE slot to the file system, the data items are:

/Dev/hdc1/c vfat defaults 0 0

(/C is a pre-created folder, which serves as the mount point of drive c .)
... The remaining full text>

For details about the parameters in the etc/fstab file in linux, especially the parameters in the fourth item

Item 1, Item 2, Item 3, item 4, item 5, item 6
/Dev/cdrom/mnt iso9660 defautlts 0 0
Item 1: the device to be mounted Item 2: mount point item 3: Mount format
Item 4: file system parameters. For example, async/sync (whether to allow disk data in memory to be written in different ways/synchronously), auto/noauto (automatically/not automatically loaded into the partition at startup ), rw/ro (this partition is loaded in read-write/read-only mode), exec/noexec (this file system is restricted to "execute" operations ), user/nouser (determine whether to allow users to use the mount command to load), suid/nosuid (set whether the file system permits the existence of SUID permissions ), usrquota (the Startup file system supports the disk quota mode), kgquota (the Startup file system supports the disk quota mode of the user group), and defautlts (with rw, suid, dev, exec, anto, nouser, async, and other parameters ).
Item 5: dump BACKUP command Item 6: whether to use fsck to test the partition at startup (0 is not to test, 1 is to test, and 2 is to test, however, 1 will be tested earlier than 2 .)

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.