Linux disk quota management

Preface:

Disk quota management mechanism for disk space, disk quotas limit the maximum use of space a user or group that can be used in a particular file system. Linux system is a multi-user multitasking operating system when using the system, there will be multi-user share a disk, the user if a few of them take up a lot of disk space, the other is bound to compressed disk space and user permissions. Therefore, the system administrator should open the appropriate permissions to the disk to the user to the proper allocation of system resources.

Implement disk quotas conditions:

  • Linux kernel support needs.
  • Installation xfsprogs and quota package.

Check whether the Linux system installed xfsprogs and quota package with the two commands.

输入:rpm -qa | grep xfsprogs-----------------查看所有安装并过滤xfsprogs
输入:rpm -ql xfsprogs |grep quota----------查看xfsprogs安装详情并过滤出quota

Linux disk quota management

Linux disk quota characteristics:

**> scope: for a specified file system (partition)

Restrictions target: user accounts, group accounts
limit types: disk capacity, the number of documents
the limitations: soft limit, hard limit **

Edit disk quota settings:

1. "setenforce 0" command closes enhanced security features, Linux6 version needs to be closed disk quotas, Linux7 optimized without closing the can.
Linux disk quota management
2. vim editor of the / etc / fstab file to configure disk quotas to increase mbox02 rights, the default permissions added after defaults on usrquota grpquota rights and privileges, separated by commas.
Linux disk quota management
Linux disk quota management

3. mbox02 logic area solution linked and then remount, permissions sync at the previous step configuration.
Linux disk quota management

4. Use the mount command to mount View details, find permission to turn on disk quotas.

Linux disk quota management

5. Create a new user for its disk quota. (Written before the user and group management, not friends can look through it)
Linux disk quota management

6. zhangsan user disk quota configuration. Soft limit its file size is limited to 50M, 80M hard limit; soft limit quantity file to four, six hard limit. (Note: The soft limit can not exceed the hard limit, soft limit that is less hard limit)
Linux disk quota management

7. Next we use zhangsan users to partition to write something, but do not have write permission mbox02 zhangsan, so give him a permission.
Linux disk quota management

8. Verify whether to limit the number of files successfully, let's switch to the zhangsan user, and then enter mbox02 directory, create an empty file in the directory, when the number of files reaches the hard limit six, and then create a new file failed.
Linux disk quota management

9. Verify that the file size limit is successful, we delete the file before the first empty, then take the junk files from / dev / zero into mbox02 took him a success 50M, 50M is shouting to us than the hard limit 80M, so only He took 30M.
Linux disk quota management

10. We use the exit command to return to the root user, and then look at the use of disk quotas.
Linux disk quota management

Guess you like

Origin blog.51cto.com/14449541/2431289