Disk quota Quota

Source: Internet
Author: User
Tags disk usage

Limits can be set for users (Usrquota), groups (Grpquota)
The type of quota has block size (block) (How much file can be generated), number of nodes (Inode) (How many files)

Let partition support disk quota function

#lvcreate-l 3g-n qdisk sys
#mkfs. Ext4/dev/sys/qdisk
#mkdir/mnt/qdisk
#mount-O Usrquota,grpquota/dev/sys/qdisk/mnt/qdisk
#vi/etc/fstab
------------------------
/dev/sys/qdisk/mnt/qdisk ext4 Defaults,usrquota,grpquota 0 0
------------------------

#chmod 1757/mnt/qdisk

#useradd U1
#useradd U2
#useradd U3

Need to know before setting quotas

01 Audience (User,group root unrestricted)
02 Restrictions (Block,inode)
03 Limit Strength (Soft,hard)

Grace Time: Default 7 days
Once you have exceeded the soft limit, the system's grace time starts to tick,
After grace time expires, your hard value will be adjusted to your current overrun value.

Basic commands

Quotacheck//scan for directories with Usrquota,grpquota and create quota record files

-A//scan all currently mounted partitions that support the quota feature
-u//Create quota record file for user
-g//Create quota record file for group
-V//display information during the scanning process

Quotacheck [-AUGV] [Mount_point]

#yum provides */quotacheck
#yum Install quota

# Quotacheck-avgu
# Quotacheck-ugv/mnt/qdisk

Quotaon//Boot disk quota feature
Quotaon-ugv/mnt/qdisk

Quotaoff//Off
Quotaoff-ugv/mnt/qdisk

Edquota//Edit
Edquota [-u username] [-g GroupName]

-U//user
-G//Group (primary Group)
-T//grace time
-p//replication user's disk quota limit


Edquota-u U1
----------------------------------------------------
Block soft hard inode soft hard
51200 102400 20 40

#su-U1
$CD/mnt/qdisk
$dd If=/dev/zero of=file1 bs=1m count=30; Sync
$dd If=/dev/zero of=file2 bs=1m count=30; Sync
$dd If=/dev/zero of=file3 bs=1m count=30; Sync
$dd If=/dev/zero of=file4 bs=1m count=30; Sync

#repquota-A

$RM-F file*


$touch {1,2,3,4,5}{1,2,3,4,5}
$touch a{1,2,3,4}{1,2,3,4}

#repquota-A


Sync Force writeback (writes back data that has been modified in memory but not saved to disk)
Linux is an asynchronous synchronous operating system
Will put multiple small write streams together into a large write stream to write back to the hard disk
This avoids frequent I/O operations

When we restart the system with the reboot command, the first operation of the system is sync
---------------------------------------------------
The process of disk quotas

01 Dividing a partition
02 mount a partition to a directory with the (Usrquota,grpquota) property
Use Mount to verify
03 using quotacheck-a or QUOTACHECK-UGV mount_point
To check if the quota file exists user; Group
04 Boot disk Quotas QUOTAON-UGV "Mount_point"
Edquota-t
Edquota-u User Name
EDQUOTA-G group name (can not be a subordinate group)
07 using Repquota-a to view disk usage

Disk quota 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.