Get the App
SLTechnology News&Howtos  ›  Servers  › 

Setting method of disk quota under Redhat Linux system

Shulou Source: shulou.com Published: 2022-06-01 18:36:38 09月22日 Update

This article mainly explains "the setting method of disk quota under Redhat Linux system". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "the setting method of disk quota under Redhat Linux system".

Quotas make it impossible for individual users and groups to occupy all the space of the partition. You can configure quotas by limiting the number of inode, where each inode is associated with a specific file, or you can set an absolute limit (number of KB).

By default, readhat installs and activates the quota rpm package. If you're not sure, you can run the command: rpm-Q quota.

Quotas are usually activated in the kernel.

To use quotas for specific users, there are six steps:

one. Modify / etc/fstab to activate quota options for the selected file system

two. Remount the file system for the changes to take effect

three. Create an aquota.user file at the beginning of the file system.

four. Scan the corresponding file system and generate basic quota files with the quotacheck command

five. Use the edquota command to impose quota restrictions on specific users

six. Finally, activate the quota with the quotaon command.

The following is an example of how to impose a disk quota limit on user test under / partition:

Modify / etc/fstab

# vi / etc/fstab, in

LABEL=/ / ext3 defaults 1 1 line activates the disk quota, and the modified result is as follows:

LABEL=/ / ext3 defaults,usrquota 1 1

After saving and exiting.

Remount the file system for the changes to take effect

Reactivation / etc/fstab change: # mount-o remount /

Create an aquota.user file

The easiest way to generate the aquota.user file under the / partition is to use the touch command:

Touch aquota.user, modify the permissions of the aquota.user file to allow only root users to access:

Chmod 600 aquota.user

Conduct a quota check

You can use the quotacheck-avum command to generate the appropriate quota file.

-a: scan for file systems that support quotas in / etc/fstab

-v: generate lengthy output

-u: check user quota

-m: remount the scanned file system

Set quotas on user test

Run the following command: edquota test

LABEL=/ / ext3 defaults,usrquota 1 1

Disk quotas for user test (uid 501):

Filesystem blocks soft hard inodes soft hard

/ dev/hda2 20 100000 0 6 00

~

Make inodes soft hard settings.

Enable quota

# quotaon / (quota setting for quotaoff / can be cancelled / partition)

At this point, the quota setting for test users for the / partition is complete.

You can copy the same restrictions to other users (kk tt) with the following command:

# edquota-up test kk tt

In addition, use the repquota command to monitor quota usage.

Undefinedundefined

At this point, I believe you have a deeper understanding of "the setting method of disk quota under the Redhat Linux system". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Quota file system command user activation method disk generate load limit content situation learning check run lengthy practical deeper same Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Redmi Shulou Technology MariaDB Shulou Tech Info