All Products
Search
Document Center

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

Last Updated:Mar 09, 2026

The Container Storage Interface (CSI) plug-in supports quota limits for subdirectories in General-purpose NAS volumes. When a NAS subdirectory is mounted via subPath, directory quotas can be enabled to cap capacity and improve utilization. When the quota is reached, the subdirectory can be expanded online by increasing the PVC size without service interruption.

Prerequisites

  • The CSI component is installed in your cluster and the version is v1.18.8.45 or later. To upgrade the component, see Update csi-plugin and csi-provisioner.

  • A NAS file system and mount target have been created and meet the following conditions:

Limits

The directory quota feature is supported only for dynamically provisioned NAS volumes that use the NFS protocol with General-purpose NAS and are mounted using the subpath method. Statically provisioned NAS volumes and dynamically provisioned NAS volumes mounted using the sharepath or filesystem method do not support this feature.

Note

For more information about the limitations of the directory quota feature, 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.

    Pay attention to the following parameters. For more information, see Use dynamically provisioned NAS volumes.

    Parameter

    Description

    parameters

    volumeAs

    When you use the directory quota feature, you must set this parameter to subpath, which indicates that a subdirectory of the NAS file system is mounted as a PV.

    server

    The mount target of the NAS file system. For more information about how 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

    This parameter is available only for General-purpose NAS file systems. If you set this parameter to true, a quota is configured for the PV that is dynamically provisioned using 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 appears.磁盘配额

  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