Increase disk quota limit on CENTOS6

Source: Internet
Author: User

Five users, each with a quota of 10MB (hard) and 8MB (soft) per user

0
Environment
[Email protected] ~]# uname-a
Linux localhost.localdomain 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 03:15:09 UTC x86_64 x86_64 x86_64 gnu/linux
[Email protected] ~]# nl/etc/issue
1 CentOS Release 6.5 (Final)
2 Kernel \ r on an \m

1
Built 5 user Vbirdn, this is borrowed from Brother Bird.
[Email protected] ~]# VI au.sh
#!/bin/bash
Groupadd Vbirdgroup
For username in vbird1 vbird2 vbird3 vbird4 vbird5
Do
Useradd-g Vbirdgroup $username
echo "Password" | passwd--stdin $username
Done

[Email protected] ~]# sh au.sh
Changing password for user vbird1.
Passwd:all authentication tokens updated successfully.
Changing password for user vbird2.
Passwd:all authentication tokens updated successfully.
Changing password for user vbird3.
Passwd:all authentication tokens updated successfully.
Changing password for user Vbird4.
Passwd:all authentication tokens updated successfully.
Changing password for user Vbird5.
Passwd:all authentication tokens updated successfully.

2
One Glance Home catalogue
[Email protected] ~]# ll/home/
Total 28
DRWX------. 4 Vbird1 vbird1 4096 Dec 1 15:57 vbird1
DRWX------. 4 Vbird2 vbird2 4096 Dec 1 15:57 vbird2
DRWX------. 4 Vbird3 vbird3 4096 Dec 1 15:57 vbird3
DRWX------. 4 Vbird4 vbird4 4096 Dec 1 15:57 vbird4
DRWX------. 4 Vbird5 vbird5 4096 Dec 1 15:57 vbird5
DRWX------. 4 Zxw zxw 4096 Sep 18:03 Zxw

Look at the VB1 group and ID
[[email protected] ~]# ID vbird1
uid=503 (Vbird1) gid=504 (vbird1) groups=504 (VBIRD1), 503 (Vbirdgroup)

3
For the newly built ones, prepare a directory for these users to access/home/vbirdgroup
[Email protected] ~]# Mkdir/home/vbirdgroup
[Email protected] ~]# chgrp vbirdgroup/home/vbirdgroup/
[Email protected] ~]# chmod 2770/home/vbirdgroup/

[Email protected] ~]# ll-d/home/zhaoxiaowei/
DRWX---rwx. 5 Zhaoxiaowei zhaoxiaowei 4096 Sep 14:13/home/zhaoxiaowei/

Set fourth bit, which is in front of the three-bit permission sequence, and the fourth digit value is 4,2,1, which means the following:
4, the user ID is set at execution time, and is used to authorize the file owner-based process instead of the user who created the process.
2, when executed, sets the user group ID, which is used to authorize the process based on the group of files, rather than on the user who created the process.
1, set the sticky bit.

4
Disk Quota Summary Now
For quota under/home, you need the following:
File system support
Quota Data File Building
Quota Start
Establish user quota information

5
Separate/home partition, because quota only supports filesystem and does not support a single directory
Add Usrquota,grpquota on/home
[Email protected] ~]# Nl/etc/fstab

1 #
2 #/etc/fstab
3 # Created by Anaconda on Tue Dec 2 18:52:50 2014
4 #
5 # Accessible Filesystems, by reference, is maintained under '/dev/disk '
6 # See mans Pages Fstab (5), Findfs (8), mount (8) and/or Blkid (8) for more info
7 #
8 UUID=93CD7207-78C4-4A95-BE1B-7451772C21AD/EXT4 Defaults 1 1
9 Uuid=9a982f8d-d590-49f2-9cf1-e07a5b8238dd/boot ext4 Defaults 1 2
Ten Uuid=c8939b59-9a73-45fa-bd5a-f016a5aa631e/home Ext4 Defaults,usrquota,grpquota 1 2
uuid=1f3d9eaf-e140-47ab-ae99-fcf1516d2070 swap swap defaults 0 0
TMPFS/DEV/SHM TMPFS Defaults 0 0
Devpts/dev/pts devpts gid=5,mode=620 0 0
Sysfs/sys Sysfs Defaults 0 0
PROC/PROC proc Defaults 0 0

6
Unload, load/home, and view/home items
[Email protected] ~]# umount/home/; Mount-a
[email protected] ~]# Mount | grep Home
/dev/sda3 on/home type EXT4 (Rw,usrquota,grpquota)

7
Quotacheck generate quota file, the result is as follows
[Email protected] ~]# Qutoacheck-avug
-bash:qutoacheck:command not found
[Email protected] ~]#

8
Find, install quota
[Email protected] ~]# Find/-name Qutoacheck
[Email protected] ~]#
[Email protected] ~]# Rpm-qa | grep quota
Quota-3.17-20.el6.x86_64

Installation
[Email protected] ~]# yum-y install quota-3.17-20.el6.x86_64
Loaded Plugins:fastestmirror, Refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base:centos.ustc.edu.cn
* extras:centos.ustc.edu.cn
* updates:centos.ustc.edu.cn
Base | 3.7 KB 00:00
base/primary_db | 4.6 MB 00:29
Extras | 3.4 KB 00:00
extras/primary_db | KB 00:00
Updates | 3.4 KB 00:00
updates/primary_db | 910 KB 00:05
Setting up Install Process
Nothing to do
[Email protected] ~]#

9
Enable restrictions to generate user and group restriction files
[Email protected] ~]# Quotacheck-avug
Quotacheck:your kernel probably supports journaled quota but is not using it. Consider switching to journaled quota to avoid running quotacheck after an unclean shutdown.
Quotacheck:scanning/dev/sda3 [Home] Done
Quotacheck:cannot stat old user quota file/home/aquota.user:no such file or directory. Usage is not being substracted.
Quotacheck:cannot stat Old group quota file/home/aquota.group:no such file or directory. Usage is not being substracted.
Quotacheck:cannot stat old user quota file/home/aquota.user:no such file or directory. Usage is not being substracted.
Quotacheck:cannot stat Old group quota file/home/aquota.group:no such file or directory. Usage is not being substracted.
quotacheck:checked directories and the files
Quotacheck:old file not found.
Quotacheck:old file not found.

[Email protected] ~]# Quotaon-avug
/dev/sda3 [Home]: Group quotas turned on
/dev/sda3 [Home]: User quotas turned on

10
Increase quota limits
[Email protected] ~]# edquota-u vbird1
Disk quotas for User vbird1 (UID 501):
Filesystem blocks soft hard inodes soft hard
/dev/sda3 32 8000 10000 8 0 0
Unit is KB
[Email protected] ~]# edquota-u Vbird2
。。。

[Email protected] ~]# edquota-p vbird1 vbird2 vbird3 vbird4 vbird5

11
View quotas
[Email protected] ~]# Repquota-au
Report for user quotas on Device/dev/sda3
Block Grace Time:7days; Inode Grace Time:7days
Block Limits File Limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
Root--24 0 0 3 0 0
ZXW--32 0 0 8 0 0
Vbird1--32 8000 10000 8 0 0
VBIRD2--32 8000 10000 8 0 0
Vbird3--32 8000 10000 8 0 0
VBIRD4--32 8000 10000 8 0 0
VBIRD5--32 8000 10000 8 0 0

12
Start testing
[Email protected] ~]$ ll-h
Total 7.6M
-rw-rw-r--. 1 vbird1 vbird1 1.7M Dec 2 14:01 cont.txt
-rw-r--r--. 1 root root 49K Dec 2 13:59 Install.log
-rw-rw-r--. 1 vbird1 vbird1 5.8M Dec 2 14:02 v.txt
[Email protected] ~]$

VB1 write file to reach soft limit
[Email protected] ~]$ nl cont.txt >> v.txt
sda3:warning, user block quota exceeded.
Soft limit reached, warning
[Email protected] ~]$ ll-h
Total 9.5M
-rw-rw-r--. 1 vbird1 vbird1 1.7M Dec 2 14:01 cont.txt
-rw-r--r--. 1 root root 49K Dec 2 13:59 Install.log
-rw-rw-r--. 1 vbird1 vbird1 7.7M Dec 2 14:02 v.txt

VB1 write files to reach hard limit
[Email protected] ~]$ nl cont.txt >> v.txt
Sda3:write failed, user block limit reached.
Nl:write Error:disk Quota exceeded
Reach hard Limit, error
[Email protected] ~]$
[Email protected] ~]$ ll-h
Total 9.8M
-rw-rw-r--. 1 vbird1 vbird1 1.7M Dec 2 14:01 cont.txt
-rw-r--r--. 1 root root 49K Dec 2 13:59 Install.log
-rw-rw-r--. 1 vbird1 vbird1 8.1M Dec 2 14:03 v.txt

VB1 Write it, you won't let it go.
[Email protected] ~]$ nl cont.txt >> v.txt
Nl:write Error:disk Quota exceeded
[Email protected] ~]$ ll-h
Total 9.8M
-rw-rw-r--. 1 vbird1 vbird1 1.7M Dec 2 14:01 cont.txt
-rw-r--r--. 1 root root 49K Dec 2 13:59 Install.log
-rw-rw-r--. 1 vbird1 vbird1 8.1M Dec 2 14:03 v.txt


can refer to
http://blog.csdn.net/java3344520/article/details/8154602
Subsequent extensions can refer to
http://linux.vbird.org/linux_basic/0420quota.php



-----------------
Reprint please specify the source:
Blog.csdn.net/beiigang

Increase disk quota limit on CENTOS6

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.