Updated on 2025-09-26 GMT+08:00

Configuring Mount Options for a File System Volume

This section describes how to configure mount options for a file system volume. You can configure mount options for a PV and then bind the PV to a PVC.

Prerequisites

You have used ccictl to access CCI 2.0. For details, see ccictl Configuration Guide.

Mount Options for a File System Volume

CCI 2.0 presets the options described in Table 1 for mounting a file system volume.

Table 1 Mount options

Parameter

Mandatory

Type

Description

vers

Yes

Int

Description: File system version. Currently, only NFSv3 is supported.

Constraint: The value is 3.

nolock

Yes

String

Description: Whether to use the NLM protocol to lock files on the server. If nolock is used, the file locks applied by applications on one client are effectively locally, which prevents other applications on the same client from accessing the locked files, but they do not prevent other NFS clients from accessing those same files on the server.

Default value: nolock

timeo

Yes

Int

Description: The waiting time before the NFS client retransmits a request. The unit is 0.1 second.

Default value: 600

hard/soft

Yes

String

Description: mount mode.

  • hard: If the NFS request times out, the client keeps resending the request until the request is successful.
  • soft: If the NFS request times out, the client returns an error to the invoking program.

Default value: hard

You can configure other mount options if needed. For details, see Mounting an NFS File System to ECSs (Linux).

Configuring Mount Options in a PV

You can use the mountOptions field to configure mount options in a PV. The options you can configure in mountOptions are listed in Mount Options for a File System Volume.

  1. Configure mount options in a PV. The following is an example:

    apiVersion: cci/v2
    kind: PersistentVolume
    metadata:
      name: pv-sfs
    spec:
      accessModes:
      - ReadWriteMany      # Access mode. The value must be ReadWriteMany for file system volumes.
      capacity:
        storage: 1Gi       # Storage capacity. This parameter is only for verification. It must not be empty or 0, and the specified size will not take effect.
      csi:
        driver: nas.csi.everest.io    # Storage driver for the mounting
        fsType: nfs
        volumeHandle: <your_volume_name>   # Name of the general-purpose file system
        volumeAttributes:
          everest.io/share-export-location: <your_location>  # Shared path of the file system
          everest.io/sfs-version: sfs3.0       # sfs3.0 indicates that General Purpose File System is used.
      persistentVolumeReclaimPolicy: Retain    # Reclaim policy
      storageClassName: csi-sfs                # csi-sfs indicates General Purpose File System.
      mountOptions:                            # Mount options
      - vers=3
      - nolock
      - timeo=600
      - hard

  2. Create a PVC, bind the created PV to it, and mount the PVC to the containers in the workload. For details, see Configuring Mount Options for a File System Volume.
  3. Check whether the mount options are effective.

    In this example, the PVC is mounted to the workload that uses the nginx:latest image. You can run the mount -l command to check whether the mount options take effect.
    1. View the pod that the file system volume has been mounted to. In this example, the workload name is web-sfs.
      ccictl get pod -n test-sfs-v1 | grep web-sfs

      Information similar to the following is displayed:

      web-sfs-***   1/1     Running   0             23m
    2. Run the following command to check the mount options (web-sfs-*** is an example pod):
      ccictl exec -it web-sfs-*** -n test-sfs-v1 -- mount -l | grep nfs

      If the mounting information in the command output is consistent with the configured mount options, the mount options have been configured.

      <your_shared_path> on /data type nfs (rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,nolock,noresvport,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=**.**.**.**,mountvers=3,mountport=2050,mountproto=tcp,local_lock=all,addr=**.**.**.**)