Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of setting disk quota by Centos7

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Add a hard disk to the virtual machine and achieve automatic mount (https://www.jb51.net/article/135432.htm)

When you have finished mounting the hard drive, start the following steps

Note: you need to add usrquota and grpquota "," separated "after the configuration file / etc/fstab,defaults.

Such as:

/ dev/sdb1 / mnt/daobin ext4 defaults,usrquota,grpquota 0 0

Mount command to mount it first

Mount / dev/sdb1 / mnt/daobinmount-o remount / mnt/daobin / / there is no need to restart the system

Check to see if it is mounted

Mount | grep daobin

Create a quota file using the quotacheck command

Quotacheck-ugcv / dev/sdb1ls / mnt/daobin / / create aquota.group and aquota.user for success

Create a file quota user

Useradd daobin

Use the edquota command to set quotas

Edquota-u daobin / / the configuration file will pop up after you enter.

Description: the first soft represents the disk capacity soft limit, the second soft represents the soft limit on the number of files, the first hard represents the hard limit on disk capacity, and the second hard represents the hard limit on the number of files.

Note: you only need to modify these four corresponding parameters, and the rest remain unchanged by default.

For example, modify the capacity soft limit to 80m, hard limit to 100m, soft limit to 2 files, hard limit to 3, pay attention to alignment and save exit

Disk quotas for user daobin (uid 1000): # # do not copy into Filesystem block soft hard innodes soft hard/dev/sdb1 0 8000 100000 0 2 3

Enable quota function for file system

Quotaon-ugv / mnt/daobin

Modify permissions, otherwise verification will indicate that permissions are not enough.

Chmod 777 / mnt/daobin

Switch users to create files in / mnt/daobin for authentication

Su-daobincd / mnt/daobintouch 1 2 3 / / create a file to verify ls

Note: 1 / 2 / 3 are all created, but the third file is prompted to reach the soft limit on the number of files.

Touch 4 / / the fourth file system prompt cannot create ls / / View only 1 2 3 files

Disk quota experiment completed

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report