Linux how to set disk quotas?

Environment: CentOS7

Demand: zhang3 user on / dev / sdb1, only use the space 100M, the establishment of 200 files.

Note: XFS can not / Open quota
                  EXT4 can not open the quota for the restart remount /, quotacheck -m option to enforce. quotaon
                  (not recommended / Open quota, / home should be mounted separately.)

RPM package needed: quota

The role of disk quotas: in RHEL6 system, the kernel has been developed to support Linux file system disk quota feature, but also in the quota system, the default installation package, is used to configure and manage disk quotas.

But needs to be installed in RHEL7, mainly for function can be set to enable disk quota, disk space used by the user in a specified file system (partition), the number of file settings to prevent individual users evil

Italian or inadvertently take up a lot of disk space, so as to maintain system stability and continuous availability of storage space.

content:

EXT Series disk quotas

XFS Series disk quotas

A, EXT4 disk quotas

1. Install Packages

[root@uplooking ~]# yum install quota

2. Open the disk quota feature, began to hang heavy, and add in / etc / fstab Lane

[root@uplooking /d1]# mount -o  defaults,usrquota,remount   /dev/sdb1

[root@uplooking ~]# vim /etc/fstab

dev/sdb1        /d1     ext4    defaults,usrquota       0       0

3. Establish quota quota database (EXT4 needs, XFS is not required)

[root@uplooking /d1]# quotacheck -uvc /dev/sdb1

There are under ## and the file directory ###

4. Activate the quota feature (EXT4 required, XFS not required)

[root@uplooking ~]# quotaon /dev/sdb1

5. Give Joe Smith user quotas, only 100M, and warns when the 90M, can only be built 200 files, and gives a warning when 190

[root@uplooking ~]# setquota -u zhang3 100M 100M 200 200 /dev/sdb1

6. query quota case

Queries entire disk

[root@uplooking ~]# repquota -auvs

Query a single disk

[root@uplooking ~]# repquota /dev/sdb1

Access to personal

[root@uplooking ~]# quota zhang3

Two, XFS disk quota

1. Open the disk quota feature, began to hang heavy, and add in / etc / fstab Lane

[root@uplooking /d1]# mount -o  defaults,usrquota,remount   /dev/sdb1

[root@uplooking ~]# vim /etc/fstab

dev/sdb3        /d3         defaults,usrquota       0       0

2 .. to Joe Smith user quotas, only 100M, and warns when the 90M, can only be built 200 files, and gives a warning when 190

[root@uplooking ~]# setquota -u zhang3 100M 100M 200 200 /dev/sdb1

3. Query quota case

Queries entire disk

[root@uplooking ~]# repquota -auvs

Query a single disk

[root@uplooking ~]# repquota /dev/sdb1

Access to personal

[root@uplooking ~]# quota zhang3

 

Guess you like

Origin www.cnblogs.com/github-cn/p/11311528.html