Apsara File Storage NAS provides the quota management feature to help you manage directory quotas. You can use this feature to create, modify, or delete quotas.

Prerequisites

Quota types

Category Quota type
Application scope
  • Quota for all users: the maximum storage space for files that all users can create in a directory of a file system.
  • Quota for a single user or user group: the maximum storage space for files that a user or user group can create in a directory of a file system.
Quota level
  • Statistical quotas: If you create a statistical quota for a file system, NAS calculates only the usage of storage space in the file system. You can query and view statistical data.
  • Restricted quotas: If the used storage space for a specified directory in a file system exceeds the quota, you cannot create files or directories, or append data to the files or directories.

Limits

  • File systems

    Only NFS file systems support quota management.

  • Quotas
    For a single file system, you can configure quotas for up to 500 directories. The maximum directory depth is eight levels. For example, the depth of the root directory / is zero level. The depth of the /workspace directory is one level. The depth of the /workspace/dir1 directory is two levels.
    Important
    • If you create a restricted quota for a directory and the quota is exceeded, data can no longer be written to the directory. When the quota is exceeded, you can no longer increase file sizes, create files or directories, or move files to another directory. An IOError error also occurs at the application layer.
    • To prevent potential security risks, we recommend that you evaluate and test restricted quotas before you create the restricted quotas for core business-related directories.
    • The operation to enable a restricted quota is asynchronously performed at the backend and requires 5 to 15 minutes to take effect.

Create a quota for a directory

  1. Log on to the NAS console.
  2. In the left-side navigation pane, choose File System > File System List.
  3. Find the file system to which the directory belongs. Then, click the file system ID or click Manage in the Actions column. On the Quota Management page, click Create Directory Quota.
  4. In the Create Directory Quota dialog box, specify a directory for the Directory Path parameter. Example: /dir/subdir1.
    Note
    • You can configure quotas only for directories that are created in a NAS file system.
    • Each quota is associated with a directory. The directory that you specify in this step is the absolute path of the directory in the NAS file system.
  5. Query the status of the quota.
    After the quota is created, the quota is automatically initialized and is in the In initialization state. The duration of the initialization process varies based on the number of files and subdirectories in the directory of the file system. After the quota is initialized, the quota is in the Running state. A statistical quota is automatically added to the list of quotas.

Assign a quota to a user for a directory

On the Quota Management page, find the directory and choose Manage Quotas > Assign Quota to User. In the Add User Quotas panel, configure the parameters. The following table describes the parameters. add_user_quota
Parameter Required Description
Type of User Yes The type of user. Valid values: Uid, Gid, and AllUsers. The value Uid indicates a user. The value Gid indicates a user group. The value AllUsers indicates all users. You can assign different quotas to multiple users for a directory.
ID No If you set the Type of User parameter to Uid or Gid, this parameter specifies the ID of a user or the GID of a user group.
  • If you set the Type of User parameter to Uid or Gid, you must configure the ID parameter.
  • If you set the Type of User parameter to AllUsers, you do not need to configure the ID parameter.
Examples:
  • If you want to assign a quota to a user whose ID is 500, set the Type of User parameter to Uid and set the ID parameter to 500.
  • If you want to assign a quota to a user group whose ID is 100, set the Type of User parameter to Gid and set the ID parameter to 100.
  • If you want to assign a quota to all users, set the Type of User parameter to AllUsers. You do not need to configure the ID parameter.
Quota Type Yes
  • Statistical: If you set this parameter to Statistical, NAS calculates only the usage of storage space in a specified directory of the file system.
  • Restricted: If you set this parameter to Restricted and the restricted quota is exceeded, specific I/O operations can no longer be performed.
Capacity Limit (GiB) No The maximum size of files that a user can create in a directory.
Note This parameter is available only for restricted quotas. You must configure at least one of the Capacity Limit and File Limit parameters.
File Limit No The maximum size of files and the maximum number of subdirectories that a user can create in a directory.
Note This parameter is available only for restricted quotas. You must configure at least one of the Capacity Limit and File Limit parameters.

Delete a quota that is assigned to a user for a directory

On the Quota Management page, find the quota that you want to delete, and click Delete.

Modify a quota that is assigned to a user for a directory

On the Quota Management page, find the quota that you want to modify, and click Edit. You can modify the quota type, capacity limit, and file limit of the quota.

Note The Capacity Limit and File Limit parameters are available only for restricted quotas. You must modify at least one of the two parameters.

API operations

You can call the following API operations to manage quotas: