Brother Bird's Linux private cuisine--18th: disk quotas Quota

Source: Internet
Author: User

Video link:

Disk quota quota means to give users the space to use disk quotas, for example, your Baidu network disk use space, the use of other cloud disk space. Before using the quota command, we need to do some work, first we mount a hard disk, first use Fdisk to create a partition

Fdisk/dev/sdb    #创建分区咯

Then I created a primary partition SDB1, and then we'll format the partition and then mount it ~ ~

mkfs.ext3/dev/sdb1    /dev/sdb1  /home/jim/test    #挂载它到/home/jim/test below

Of course, here we'd better choose to automatically mount, here more quota~~

/DEV/SDB1  /home/jim/test  12

After we've all been configured, we'll start our quota tour.

1. What is quota (quota is assigning disk quotas to users)

2. Introduction of basic quota instruction:/etc/mtab, quota, Quotacheck, Edquota, Quotaon, Quotaoff

3. Implementation quota

4. Quota instances without changes to existing systems

General use of quota

? For WWW server, for example: the capacity limit for everyone's web space!
? For mail server, for example: The message space limit for everyone.
? For file server, for example: Maximum available network hard disk space for each person.

We always say that quota is restricting disk quotas, so how is it limited?

    • Soft minimum limit capacity, can exceed this in the grace time, but before the grace time over to fall down
    • Hard this is definitely not allowed to exceed the capacity!
    • Grace time will start when the grace period exceeds soft

You can go to/etc/mtab and see if your disk support is not supported quota

Quota

-U is followed by the user, displaying its quota limit value, not writing the default current performer

-G is followed by a group that shows the group's quota limit value

-V Displays the quota value for each filesystem

-S is displayed with Inode or disk capacity limit values

-L Displays the quota value of the filesystem above the current machine

Example one: Show your own quota limit value

Quota  -guvs

Example two: I want to see Jim's disk quotas

Quota-vs-u Jim

Quotacheck

-A: Scan all within the/etc/mtab, containing quota support filesystem, plus this parameter,/mount_point can not write, because the scan all the filesystem!

-U: for user scan files and directory usage, will establish aquota.user

-G: For group scan file and directory usage, will establish aquota.group

-V: Displays information about the scanning process;

-M: "Force" for Quotacheck scan.

Example one: Scan a partition with quota support within the/etc/mtab

Quotacheck-avug

The first time is a mistake, do not worry, because it may be corrupted file format, this time we will use the mandatory quotacheck command

QUOTACHECK-CFMVF  vfsv0/Home   

This mandatory implementation is good, specific details please see my blog specifically to write this question http://www.cnblogs.com/yunquan/p/6914320.html

Edquota

-U: followed by the account name. Can enter the quota edit screen (vi) to set the username limit value;

-G: Follow the group name. Can enter the quota edit screen (vi) to set the GroupName limit value;

-T: Can change the time limit (that is, after the soft limit value of quota, you can also use the hard drive grace period)

-P: Copy the template. The Username_demo is a user who already exists and has set up a quota, meaning "copy the quota limit value username_demo this person to username"!


Example one: Setting Jim's quota limit value

Edquota-  u  Jim

Example two: Talking about Jim's quota limit value copied to Tom user

Edquota-p jim-u Tom

Example three: revision of forgiveness time

Edquota-t

Quotaon

-U: Start quota for user (Aquota.user)

-G: Quota for Group launch (Aquota.group)

-V: Displays information about the startup process;

-A: According to the/etc/mtab within the filesystem set to start the relevant quota, if not add-a, then you need to add a specific filesystem Oh!

Example one: Start all filesystem with quota

Quotaon  -avug

Example two: Start the user quota setting value only in/home

Quotaon-uv/home

Sometimes you may not succeed in playing Quotaon? Then Quotaoff first, then Quotaon.

Quotaoff

-A: All filesystem quota are off (according to/etc/mtab)
-u: Close user quota only for the/mount_point that follow up
-G: Close group quota only for the next/mount_point

Example one:

Quotaoff-a

OK, so here it is. Quota command we have almost finished learning, the following we will be practical to operate a bit

First, set up a group and two users to play
-M---M-g qgroup quser2passwd  quser1passwd quser2
Second, add quota support to filesystem

In/etc/fstab, add Usrquota and Qrpquota.

/DEV/SDB1  /home/jim/test  12

After writing it, because quota is reading/etc/mtab this file. And this file has to be restarted before the Fstab files are read, but I don't want to shut down.

Mount -o remount/hoem/jim/test
Third, scan the use of the disk, and produce aquota.group and aquota.user these two files

Use the Quotacheck command to enforce if it doesn't work

-avug# If it doesn't work, enforce this.
QUOTACHECK-CFMVF  vfsv0   /home/jim/test
Iv. threshold for starting quota

Use Quotaon, if not, then Quotaoff Quotaon

Quotaon  -AUVG
Five, the use of the user's space to edit

I wrote Quser1, and then copied it to Quser2.

Edquota-u Quser1

Copy to Quser2

Edquota-p Quser1 Quser2

Then set the Grace time.

Edquota-t

After the setup is complete, we can view it through quota.

Quota-vu Quser1 Quser2
Vi. editing the space that a group can use
--VG Qgroup

Why edit a group's usage space? Because Ah, people are not OK, more people you go to set to try? Today Zhang San said space is not enough, tomorrow John Doe said space is full ... Think about the big head, simply set the group space, let them play. As long as they're all in space, not more than the hard work of the group.

Seven, set boot start quota

This is not necessary, because the default is the boot, but! If there's something wrong with your computer, do it.

vi /etc/rc.d/rc.local      #进去/sbin/quotaon-avug    #加上这一行
Viii. using Repquota to show more complete quota results
Repquota-av

Quota instances without modification of existing systems

It's your disk quota, preferably a separate disk, so what if you don't set the directory on a separate disk?

Brother Bird's Linux private cuisine--18th: disk quotas Quota

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.