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

How to realize File system quota in Linux

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces you how to achieve file system quotas in Linux, the content is very detailed, interested friends can refer to, hope to be helpful to you.

1. Quotas, also known as quotas, are for partitions, neither users nor files, let alone the entire hard disk.

two。 The kernel version must be 2.4 or higher to support it; check to see if the kernel supports quotas.

3.root is not subject to quota restrictions, only ordinary users are restricted.

4. Terms in quotas:

Soft limit: warning limit, which can be broken

Hard limit: maximum available limit, unbreakable

Quota size: in size K and in the number of files

Quota grace date: the grace time for reducing the hard limit back to the soft limit

5. Quotas can be set for users or groups, called:

User quota: usrquota

Set quotas for a single user

Group quota: grpquota

Set quotas for all members of the entire group

6. Configuration steps for quotas:

# vi / etc/fstab # File systems and partitions that need to be mounted when the system starts up

Enable the quota feature when the / home partition is mounted, and modify as follows:

# mount-o remount / home # re-unmount and mount the partition used as quota

# cat / etc/mtab # check whether disk quotas are enabled for mounted partitions

Note: / etc/mtab this file is the partition that has been mounted after the system boot.

Quota detection: detects quotas in the system, creates quota files under the partition and writes system quota information

# useradd us1

# quotacheck-cavug

# ll / home # check whether / home produces two quota database files

Edit the quota size for a user or group

# edquota-u us1

# edquota-g us1

View user and group quota report

# repquota-a

# repquota-ag

Enable quota featur

# quotaon-avug

Test the user's quota

# su-us1 / / switch normal user test user quota

$cp / bin/* / home/us1 / / copy files to test the effect of quota limits

# repquota-a / / View quota report

Check the used size of the current directory

# du-h

Modify the grace time of the quota (for the entire partition, the time unit can be days, hours, minutes, seconds)

# edquota-t

Quota replication (multiple target users can be specified at the same time)

# edquota-p us1 us2 us3 us4 us5

Let's show you how to implement file system quotas on Linux systems.

Create a disk partition / dev/sdb1

Check to see if the partition is created successfully and synchronized

Format / dev/sdb1 partition

Create / mnt/home temporary mount point

Mount / dev/sdb1 to / mnt/home

Migrate / home data to / mnt/home directory

Mount the / dev/sdb1 partition to the / home directory

Temporary mount point / mnt/home before uninstallation

Modify the configuration file to realize automatic mount on boot

Modify fstab file add mount option usrquota,grpquota

Remount it to make it effective

Create a quota database

Check whether the quota database is enabled

Enable quota database

Set user wangcai disk quota

View the disk quota of user wangcai

View disk quotas on a partition

Note: if the following error occurs while creating the quota database

You can solve the problem by using the following methods

On how to achieve file system quotas in Linux to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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

Database

Wechat

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

12
Report