Linux disk quota settings

Source: Internet
Author: User

Linux is a multi-user multi-tasking operating system, which inevitably occurs when multiple users share the disk, how to make the use of disk for multiple users, is the disk configuration to solve the problem. Of course, you can also create a user's home directory on a separate logical partition, but this is too cumbersome and inflexible.

Set the user's disk quotas as an example of user-specific configuration.

Environment:Red Hat6.1 64bit

The steps are as follows:

1. Create a Myquota user and set disk quotas for this user.


2. create a logical partition and set quotas on this partition.


3. Create A mount point for the file Sda6


Where the /etc/fstab profile information is modified as follows, the main use of mount-a to make the configuration file effective.



Note: If the partition system is already partitioned, and want to do disk quotas, you can first use MOUNT-A to see all the system mount points, such as a mount point is/TMP/SDB1, you can use the command dynamic modification (if this is the case for disk quotas, the above steps do not need to)
Example: Mount-o remount,usrquota,grpquota /tmp/sdb1 //re-mount the root partition and enable quotas
(The next steps are the same, but the mount point becomes the /tmp/sdb1)

4. Use the quotacheck command to generate the configuration disk configuration database file, if selinux is open, will prompt insufficient authority, through Setenforce 0 temporarily shut down SELinux Yes,quotacheck execution can see that there are more than two files under/quota/. the disk quota function on the corresponding file system is then initiated via quotaon/quota/.

4. Configure user Myquota to use quotas for this disk partition by Edquota-u Myquota. You can also pass

Edquota-g groupname set quotas on groupname this group

the corresponding field of the configuration file has the following meanings:

Filesystem File System

Blocks number of blocks already in use (Units of block 1K)

Soft block number soft limit, 0 means disable

Hard block number rigid limit, 0 means disable

Inodes the number of files that have been created, if there is * indicated that the soft limit has been exceeded

Soft soft limit for the number of files created, 0 means disable

Hard limit on the number of files created, 0 means disable

Edquota-p username username1 Copy the settings of the username user to the username1 user

Here to Myquota This partition disk with a soft limit of 10M, a hard limit of 20M(even if the partition has 50M of Space), the number of soft limit to 5 , hard limit to Ten .

The following test, before testing to give Myquota this user to /quota directory Write permissions.

To test the number of files:

Test for the capacity size that can be used:

Switch root users can view the current usage of each disk quota using REPQUOTA-A. It can be seen that the Myquota user has reached the maximum capacity limit for disk usage.

It is important to note that when the user triggers the soft limit, grace time is counted down, and if the user does not clean up the disk so that it meets the soft limit, the soft limit becomes a hard limit at this time (the default is 7 days), which is called the grace period. You can set this time by edquota-t, setting a grace period for the capacity and number of files, respectively.

Linux disk quota settings

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.