All Products
Search
Document Center

File Storage NAS:Directory quota

Last Updated:Aug 27, 2026

Directory quotas and user quotas limit the number of files and the storage capacity that can be consumed under a directory in a General-purpose NAS file system. Set a quota to monitor how a shared directory is used, or to prevent a single user or user group from filling it.

Prerequisites

  • A General-purpose NAS file system is created. For more information, see Create a file system.

  • A mount target is added. For more information, see Create a mount target.

  • A permission group and rules are created. For more information, see Procedure.

  • The file system is mounted based on the mount scenario and a directory is created in the file system. For more information, see Mounting scenarios.

Quota type

Classification

Quota type

Scope of quota statistics

  • Directory quota: collects file system usage of all users under a directory.

  • User (group) quota: collects file system usage of a specific user (group) under a directory.

Note

Only General-purpose NAS file systems that use the NFS protocol support the user (group) quota feature.

Restriction level of quotas

  • Accounting quota: only collects file system usage for users to view.

  • Enforcement quota: if you configure an enforcement quota for a specified directory and file system usage exceeds the quota, operations such as creating files or directories and appending data will fail.

Limits

  • File system instances

    • General-purpose NAS file systems that use the NFS protocol support directory quota and user (group) quota.

    • General-purpose NAS file systems that use the SMB protocol support the directory quota feature.

    • Extreme NAS does not support the directory quota feature.

  • Quotas

    • For a single file system, quotas can be set for up to 500 directories, and the maximum directory depth is 8 levels is supported. (For example, the root directory / has a depth of 0, /workspace has a depth of 1, /workspace/dir1 has a depth of 2, and so on.)

    • For a single directory quota, the maximum number of UID/GID combinations is 500 is supported. If the limit is exceeded, configuration failures or read anomalies may occur.

    Important
    • After an enforcement quota is set, if file usage exceeds the limit, write operations (including increasing file length, creating files, directories, and moving files to directories) will fail, and the application layer will receive an IOError. You can refer to Why does writing data to the file system return aDisk quota exceedederror message? for handling.

    • Due to the high risk of enforcement quotas, we strongly recommend that you carefully evaluate and test before configuring enforcement quotas on critical business paths.

    • After a directory quota is created, an initialization process occurs and the status is Initializing. The initialization duration depends on the number of files and directories in the file system and can take up to several hours or longer. After initialization is complete, the status changes to Running. You can query the status of directory quotas through the NAS console or by calling the DescribeDirQuotas API.

    • NAS quota settings are executed asynchronously. Therefore, enforcement quotas take effect and expire with a delay (normally 5 to 15 minutes).

  • Regions

    • General-purpose NAS file systems that use the NFS protocol: all regions.

    • General-purpose NAS file systems that use the SMB protocol: all regions except China South 1 Finance.

Create a directory quota

  1. Log on to the NAS console .

  2. In the left-side navigation pane, choose File System > File System List.

  3. In the top navigation bar, select the resource group and region where your file system resides.

  4. Find the target file system and click the file system ID or click Manage to go to the Quota Management page and click Create Directory Quota.

  5. In the Create Directory Quota dialog box, configure the Directory Path to add the directory.

    Important
    • Quotas can only be set for directories that already exist in the General-purpose NAS file system. The directory path of the quota is the absolute path of the directory in the General-purpose NAS file system, not the local path on a compute node (for example, ECS or container).

    • Directories with Chinese characters in the path name are not supported.

    For example, if the local mount path of General-purpose NAS is /mnt, and in the General-purpose NAS file system, the root directory is / with a first-level subdirectory /dir0 and a second-level subdirectory /dir/subdir1, the directory paths for configuring quotas on the root directory, first-level subdirectory, and second-level subdirectory are as follows:

    • Root directory: /

    • First-level subdirectory: /dir0

    • Second-level subdirectory: /dir/subdir1

    Configure file system ID at the same time, and click OK. NAS quota settings are executed asynchronously. Enforcement quotas take effect and expire with a delay (normally 5 to 15 minutes).

  6. Query the directory quota status.

    After a directory quota is created, an initialization process occurs and the status is Initializing. The initialization duration depends on the number of files and directories in the file system and can take up to several hours or longer. After initialization is complete, the status changes to Running. In addition, a user quota entry with the user type set to All Users and the quota type set to Accounting is automatically generated in the user quota list. This user quota only supports modifying the quota type and does not support modifying the user type.

Add a user quota

When the quota type of a user quota is accounting, it collects the usage and file count of a user (group) in the directory. When the quota type is enforcement, it limits the capacity and file count that a user (group) can use in the directory.

Note
  • Only General-purpose NAS file systems that use the NFS protocol support the user (group) quota feature.

  • Only one quota type can be configured for a single user type.

Procedure

In the Quota Management section, find the target directory path and click Manage Quotas. In the panel that appears, click Assign Quota to User and configure the relevant information in the dialog box. In the Add User Quota dialog box, File System ID and Directory Path are read-only fields. Configure the remaining parameters as needed.

Parameter

Required

Description

User Type

Yes

Specifies the type of user ID, including Uid, Gid, and All Users, which respectively restrict users, user groups, and all users. Under the same path, different quotas can be set for multiple users.

ID

No

This parameter must be configured when User Type is set to Uid or Gid. It specifies the user or user group to be restricted.

For example:

  • To restrict the user with Uid=500, set the user type to Uid and the ID to 500.

  • To restrict the user group with Gid=100, set the user type to Gid and the ID to 100.

Quota Type

Yes

  • Statistical: only collects file system usage of the specified directory path.

  • Restrictive: in addition to collecting and displaying statistics, I/O will be restricted after the quota is exceeded.

Capacity Limit (GiB)

No

This parameter must be configured when Quota Type is set to Restrictive. It specifies the maximum storage capacity of files and directories owned by the quota user under the quota path.

Note
  • The minimum storage capacity is 0 GiB and the maximum is 10,000,000 GiB.

  • You must specify at least one of capacity limit and file count limit.

File Limit

No

This parameter must be configured when Quota Type is set to Restrictive. It specifies the maximum number of files and directories owned by the quota user under the quota path.

Note
  • You must specify at least one of capacity limit and file count limit.

  • The minimum file count is 1 and the maximum is 1,000,000,000.

Delete a single user quota

In the user quota list, find the target quota entry and click Delete.

Important

When you delete a directory that has a configured quota in the file system, NAS also deletes the corresponding entries in the directory quota and user quota lists.

Edit a single user quota

In the user quota list, find the target quota entry and click Edit. The editable options include quota type, capacity limit, and file count limit.

Note

The capacity limit and file count limit can only be edited when the quota type is enforcement, and at least one of them must be edited.

API

The quota management feature provides the following API operations:

FAQ

Why does writing data to the file system return aDisk quota exceedederror message?

  • Cause

    The usage or file count of the target directory has exceeded the configured user quota limit. As a result, write operations (including increasing file length, creating files, directories, and moving files to directories) fail and an error message similar to Disk quota exceeded is returned.

  • Solution

    1. We recommend that you clean up data to free space or increase the capacity limit of the directory as soon as possible. For more information, see Edit a single user quota.

    2. After the cleanup is complete, we recommend that you first perform test write operations on the directory with the quota (for example, create and write data to a test file) to trigger asynchronous refresh of the quota cache. Verify that these test write operations succeed before restarting your business.