All Products
Search
Document Center

File Storage NAS:Configure quotas on the subdirectories of NAS NFS volumes

Last Updated:Jun 18, 2026

The CSI plug-in supports directory quotas for General-purpose NAS subdirectories mounted via subPath, enabling you to cap capacity and improve storage utilization. When a quota is reached, you can expand the subdirectory online by increasing the PVC size without service interruption.

Prerequisites

Before you begin, ensure that you have:

Limitations

Directory quotas are supported only for dynamically provisioned NAS volumes that meet all of the following conditions:

  • Protocol: NFS

  • NAS type: General-purpose NAS

  • Mount method: subPath

Directory quotas are not supported for statically provisioned NAS volumes or dynamically provisioned volumes mounted using the sharepath or filesystem method.

For the full list of directory quota limitations, see Directory quotas.

Example

  1. Modify the following YAML content and save it as alicloud-nas-quota-sc.yaml.

    apiVersion: storage.k8s.io/v1
    kind: StorageClass
    metadata:
      name: alicloud-nas-quota-sc
    mountOptions:
      - nolock,tcp,noresvport
      - vers=3
    parameters:
      volumeAs: subpath  # Set the value to subpath.
      server: "0cd8b4a576-g****.cn-hangzhou.nas.aliyuncs.com"  # The mount target of the General-purpose NAS file system that uses the NFS protocol.
      archiveOnDelete: "false"
      path: "/test"
      volumeCapacity: "true" # The dynamically provisioned volume supports the directory quota feature.
    provisioner: nasplugin.csi.alibabacloud.com
    reclaimPolicy: Delete
    allowVolumeExpansion: true # Enable the directory quota feature to allow expansion of dynamically provisioned volumes.
    Note

    To enable the directory quota feature, set allowVolumeExpansion or volumeCapacity to true. If allowVolumeExpansion is set to true, the volumeCapacity parameter does not take effect, and the directory quota feature remains enabled.

    The following table describes key parameters. For more information, see Use NAS dynamic volumes.

    Parameter

    Description

    parameters

    volumeAs

    Set this parameter to subpath to mount a subdirectory of the NAS file system as a PV. This value is required for the directory quota feature.

    server

    The mount target of the NAS file system. To view the mount target address, see Manage mount targets.

    path

    The subdirectory of the NAS file system that is mounted. The default value is /. For Extreme NAS file systems, the path must start with /share.

    volumeCapacity

    Specifies whether to enable the directory quota feature.

    If allowVolumeExpansion is set to true, this parameter does not take effect, and the quota feature remains enabled.

    allowVolumeExpansion

    Available only for General-purpose NAS file systems. Setting this parameter to true configures a quota for PVs dynamically provisioned by the StorageClass.

  2. Create the StorageClass.

    kubectl apply -f alicloud-nas-quota-sc.yaml

Verify the result

  1. Write 10 GiB of data to the /data directory mounted by the StatefulSet in Step 2.

    dd if=/dev/zero of=10G.txt bs=1M count=10000
  2. After 5 to 15 minutes, check the quota details of the subdirectory.

    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 and click the 图标 icon in the Actions column. Then, click Quota Management.

    4. On the Quota Management page, click Manage Quotas in the Actions column.

      The subdirectory has a quota limit of 20 GiB with 9 GiB currently used.配额管理

      When the 20 GiB quota is reached, further writes return the Disk quota exceeded error.磁盘配额

  3. When the quota is reached, expand the volume online.

    1. Expand the volume:

      Note

      Volume expansion does not interrupt running services.

      kubectl patch pvc nas-pvc-0 -p '{"spec":{"resources":{"requests":{"storage":"30Gi"}}}}'
    2. Query PV information:

      kubectl get pv

      Expected output:

      NAME                              CAPACITY  ACCESS MODES   RECLAIM POLICY   STATUS    CLAIM               STORAGECLASS         REASON     AGE
      nas-63c37cc2-b21e-4b56-b26f-****   30Gi          RWX          Delete        Bound    default/nas-pvc-0   alicloud-nas-quota-sc           25m23s
    3. Query PVC information:

      kubectl get pvc

      Expected output:

      NAME       STATUS   VOLUME                         CAPACITY  ACCESS MODES   STORAGECLASS            AGE
      nas-pvc-0  Bound   nas-63c37cc2-b21e-4b56-b26f-****   30Gi      RWX        alicloud-nas-quota-sc   25m10s