Directory quotas for General-purpose NAS file systems let you limit the storage space and number of files within a specific directory. The feature allows setting quotas for the directory as a whole (directory quota), for specific users and groups within that directory (user/group quota), and even different resource quotas for multiple users in the same path.
Prerequisites
A General-purpose NAS file system is created. For more information, see Create a file system.
A mount target is created. For more information, see Add a mount target.
A permission group and rules are created. For more information, see Procedure.
The file system is mounted, and a directory is created in the file system as required by your scenario. For more information, see Mounting scenarios.
Quota types
Category | Quota type |
Quota scope |
Note Only General-purpose NAS file systems that use the NFS protocol support user (group) quotas. |
Quota restriction level |
|
Usage notes
File system instances
General-purpose NAS file systems that use the NFS protocol support directory quotas and user (group) quotas.
General-purpose NAS file systems that use the SMB protocol support directory quotas.
Extreme NAS file systems do not support directory quotas.
Quotas
A single file system supports quotas on up to 500 directories. The maximum supported directory depth for a quota is 8 levels. For example, the root directory / is at depth 0, /workspace is at depth 1, and /workspace/dir1 is at depth 2.
A single directory can have quotas for up to 500 unique users (UIDs) and groups (GIDs). Exceeding this limit may cause configuration failures or read errors.
ImportantAfter you set a restrictive quota, write operations fail if file usage exceeds the limit. These operations include increasing file length, creating files and directories, and moving files into the directory. The application layer receives an IOError. For more information, see Why is the "Disk quota exceeded" error message returned when writing data to a file system?
Restrictive quotas can block critical write operations and impact your applications. It is crucial to thoroughly test them in a non-production environment before applying them to business-critical paths.
After you create a directory quota, it enters an initialization process and its status is Initializing. This process can take several hours or longer, depending on the number of files and directories in the file system. After initialization is complete, the status changes to Running. You can query the directory quota status in the NAS console or by calling the DescribeDirQuotas API operation.
NAS quota settings are applied asynchronously. Therefore, there is a delay, typically 5 to 15 minutes, before a restrictive quota takes effect or is disabled.
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 (Shenzhen) Finance.
Create a directory quota
Log on to the NAS console.
In the left-side navigation pane, choose .
In the top navigation bar, select the resource group and region where your file system resides.

Find the target file system and click its ID or click Manage. On the Quota Management page, click Create Directory Quota.
In the Create Directory Quota dialog box, set the Directory Path.
ImportantQuotas can be set only for existing directories in a General-purpose NAS file system. The directory path must be an absolute path starting from the root of the NAS file system (such as
/mydir), not the local mount path on your client (such as/mnt/mydir).Directory paths cannot contain Chinese characters.
For example, a General-purpose NAS file system is mounted to the local path
/mnt. In the General-purpose NAS file system, the root directory is/, and it has a level-1 subdirectory/dir0and a level-2 subdirectory/dir/subdir1. To configure directory quotas for the root directory, the level-1 subdirectory, and the level-2 subdirectory, the directory paths are as follows:Root directory:
/Level-1 subdirectory:
/dir0Level-2 subdirectory:
/dir/subdir1

Check the directory quota status.
After you create a directory quota, its status is Initializing while it is being created. This process can take several hours or longer, depending on the number of files and directories in the file system. After initialization is complete, the status changes to Running. A user quota entry is automatically created in the user quota list. For this entry, the user type is All Users and the quota type is Statistical. The quota type is modifiable, but the user type is not.
Add a user quota
A statistical quota tracks usage, while a restrictive quota enforces limits on storage space and file counts for a specific user or group within the directory.
Only General-purpose NAS file systems that use the NFS protocol support user (group) quotas.
Only one quota type can be configured for each user type.
Procedure
In the Quota Management area, find the target directory path and click Manage Quotas. In the panel that appears, click Assign Quota to User and configure the parameters in the dialog box. 
Parameter | Required | Description |
User Type | Yes | The type of user ID. Valid values are Uid, Gid, and All Users. These values correspond to a user, a user group, and all users, respectively. You can set different quotas for multiple users in the same path. |
ID | No | This parameter is required when User Type is set to Uid or Gid. It specifies the user or user group to limit. For example:
|
Quota Type | Yes |
|
Capacity Limit (GiB) | No | This parameter is required when the Quota Type is set to Restrictive. It specifies the maximum storage capacity that a quota user can use for files and directories in the quota path. Note
|
File Limit | No | This parameter is required if you set the Quota Type parameter to Restrictive. This parameter specifies the maximum number of files and subdirectories that a user can create in a directory. Note
|
Delete a user quota
In the user quota list, find the target quota entry and click Delete.
When you delete a directory that has a quota configured, NAS also deletes the corresponding directory quota and user quota entries.
Edit a user quota
In the user quota list, find the target quota entry and click Edit. The quota type, capacity limit, and file count limit are editable.
The capacity limit and file count limit are editable only for restrictive quotas. At least one of these two parameters must be modified.
API
The quota management feature provides the following API operations:
FAQ
Why is the Disk quota exceeded error message returned when writing data to a file system?
Cause
This error indicates that the user or group has exceeded the storage space or file count limit defined by a restrictive quota on the target directory. These operations include increasing file length, creating files or directories, and moving files into the directory. An error message such as
Disk quota exceededis returned.Solution
Free up space by deleting data or increase the capacity limit of the directory. For more information, see Edit a user quota.
After freeing up space, perform a small write operation (such as
touch testfile) in the directory. This helps trigger a faster refresh of the quota statistics. Once the write operation succeeds, restart your application.