Linux study note _ 9 _ File System Management _ 3 _/etc/fstab file analysis and Disk Quota Application

Source: Internet
Author: User
Tags touch command

--/Etc/fstab file Analysis

 

[Preface: in the previous section, partition mounting will expire after restart. To take effect permanently, you need to write it to the/etc/fstab file]

I. Format: Six Components

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

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

/Dev/sda1

 

2. Write partition information to/etc/fstab

/Dev/sdb1/web ext3 defaults 1 [if it is a data partition, check] 2 [check the order ratio/back of the Directory]

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

 

Iii. query and set the volume label

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 the first line of/dev/sdb1 to LABEL = apache, which actually works exactly the same.

 

4. added the swap Partition Function for SWAPFILE

[Dd if =/dev/sda of =/dev/sdb disk copy]

[Free-m free to view memory information.-m is displayed in MB and-g is displayed in g]

 

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

Explanation: Two pseudo devices in Linux

/Dev/zero: input 0 to the file.

/Dev/null File black hole

Bs: block size: Specifies the file block size.

Count: The file. swp file size, in bs.

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

Indicates that the size of the/var/swap/file. swp file is 10 MB, and the file content is filled with 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

4. swapon/var/swap/file. swp

Enable the newly created swap space

Swapoff/var/swap/file. swp // close 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

 

-- Disk Quota settings

Case:

/Test directory 777 50 m/user

 

1. Enable the partition Disk Quota Function

Edit the/etc/fstab file and Mark usrquota [user quota] or "User Group quota" on the Mount attribute]

Temporary settings: Run mount-o remount, usrquota/home

 

 

Permanent settings:

1. Edit the/etc/fstab file

/Dev/sda3/home ext4 defaults, usrquota 1 2

2. Commands

Mount-o remount/home

 

2. Create a quota database

Quota-cvuga [quota, quota, quota]

-C create

-V: Show Details

-U creates a detection user quota

-G: create a user group quota for detection.

-A: detects all partitions.

Quota-cvu/test // create user quota only, and accurate to/test Partition

After the first command is executed, two files, aquota. user and aquota. groups, will be created.

[There is also a way to use the touch command [frequently used in old UNIX], but we do not recommend it]

3. Enable the quota Function

Quotaon partition name

Example: quotaon/test

[Disable the quota function: quotaoff partition name]

 

Iv. edit user quota

The edquota user name enters the user quota editing mode.

For example, edquota hellen

Format description: blocks (kb) soft hard limits the size of the user's Space

Inodes soft hard limits the number of files created by the user]

Soft limit: defines the amount of disk space that a user can use. When the user exceeds this limit, the user will receive a warning that the quota is exceeded.

 

Hard limit: a file system error is reported when a user attempts to store a file in a directory that has exceeded the limit.

Edquota-t sets the grace period

 

Grace period: defines the duration for users to use their file systems under soft limits.

[Edquota-g user group name

Edit user group quota]

 

* 5. If multiple users need to copy the user quota

Edquota-p template user copy user 1 copy user 2...

 

[Quota user name to view User quota usage. You can view your disk quota without adding a user name]

[Repquota-a or repquota/test administrator to view quota Information]

 

 

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.