Fast Disk Quota solution on RHAS3

Source: Internet
Author: User
Article Title: Fast Disk Quota solution on RHAS3. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
In the case of multiple users, in order to achieve personalized management for users, not only the permissions are managed, but also the number of available space or files that can be created by users. Otherwise, some users may take the server as their own backup devices.
The limit on disk usage is the so-called Disk quota (quota), which also exists in Windows and seems to be better configured. Configuration in Linux should not be difficult.
I often use Redhat Linux, so the following experiments are based on Redhat. I believe other Linux systems should be similar.
(1) Linux quota basis
In Linux, the disk quota is divided into user quota and group quota. The Group quota is a comprehensive limitation on all users in a group.
In Linux, the disk quota is divided into soft limits (can be exceeded) and Hard Limits (cannot be exceeded) based on whether the disk quota can be exceeded)
The disk quota in Linux varies according to the restricted items, and can be divided into space limit (blocks size) and number of files limit (inodes number, not related to soft and hard connections ).
(2) Implementation of Red Hat linux as 3 Disk Quota
1) modify a file system line in/etc/fstab and add usrquota and kgquota to the Mount options. For example,/dev/sda5/mnt/sda5 ext3 defaults and usrquota, note: usrquota indicates that the user-level quota is supported, while that of the group-level quota is supported.
2) Remount the modified file system to support the quota
# Mount-o remount/dev/sda5
3) Run quotacheck to generate a quota management file in the support quota file system.
# Quotacheck-avug/dev/sda5
Simple Description: a-automatically enable the quota of the mounted file system, v-display information, u-Enable User quota, g-enable group quota
4) use edquota to set or modify user or group Quotas
# Edquota user1 [-f/dev/sda5]
# Edquota-g group1 [-f/dev/sda5]
Simple Description: The first line is to set the quota limit for user1.
The second row sets the quota limit for group group1.
The [-f/dev/sda5] Table is optional. If this parameter is left blank, the same quota settings are used for all systems with disk quotas enabled.
Quota format description:
Filesystem blocks soft hard inodes soft hard
Filesystem-the file system being set. Do not modify or delete it!
Bolock-currently used disk space
Soft (first)-limited disk space, which can be exceeded by 7 days (default), indicating the disk space available to users, in bytes
Hard (first)-hard quota limit, which cannot be exceeded, indicates the maximum disk space available to users, in bytes
Inodes-number of current files
Soft (second)-limited disk space, which can be exceeded by 7 days (default), indicating the number of files that can be created by the user, including directories, which can be exceeded by seven days by default
Hard (second)-hard quota limit, which cannot exceed, indicates the number of files that can be created by the user and cannot exceed.
5) Enable the disk quota monitoring process
# Quotaon-avug [/dev/sda1]
So far, the disk quota has been completed. How can we know the quota usage?
6) display the disk quota Usage Status
# Repquota-a or repquota/dev/sda1
# Repquota-g-a or repquota-a/dev/sda2 (group quota)
7) temporarily disable the quota of a file system
# Quotaoff-avug quota for stopping all file systems
8) cancel the quota limit of a file system
# Quotaoff-vug File System
# Delete the part of/etc/fstab that sets the quota
9) modify the maximum exceeding time of the soft quota
# Edquota-t [-g] the maximum number of days after the user/quota soft quota is exceeded. That is, after the user exceeds the soft quota, the system allows the user to continue exceeding the limit within the specified time range. The default value is 7 days, and the capability is limited. errors are inevitable. Welcome to discuss it.
9) Additional instructions
//,/Boot/,/proc,/mnt/cdrom and so on do not use the quota, in fact, it is useless.

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.