All Products
Search
Document Center

Cloud Storage Gateway:Manage NFS shares

Last Updated:Jan 20, 2025

This topic describes how to manage Network File System (NFS) shares in the on-premises file gateway console, including how to create, delete, disable, and modify NFS shares.

Prerequisites

  1. A cache disk is attached to the gateway. For more information, see Add a cache disk.

  2. Cloud resources are bound to the gateway. For more information, see Bind a cloud resource.

Background information

NFS allows computers in a network to share resources over TCP/IP. If NFS is used, the local client can directly read files from and write files to the remote NFS server.

Cloud Storage Gateway (CSG) can operate as an NFS server that provides the file sharing service. Before you can use CSG for file sharing over NFS, you must create an NFS share on the CSG, specify the users that are allowed to access the share, and configure access permissions.

Install an NFS client

Before you create an NFS share, you must install an NFS client on the client machine.

  1. Log on to the client machine.

  2. Run the following command to install an NFS client:

    The following commands install NFS clients in Ubuntu and CentOS. For information about how to install NFS clients in other operating systems, see the official NFS documentation.

    • If you are using Ubuntu, run the following command:

      apt-get install nfs-common
    • If you are using CentOS, run the following command:

      yum install -y nfs-utils

Create an NFS share

  1. Open your browser, enter https://<IP address of the file gateway> in the address bar, and then press Enter.

  2. In the dialog box that appears, enter your username and password, and then click OK.

  3. Select NFS and click Create.

  4. In the Create NFS Share dialog box, configure the parameters described in the following table and click OK.

    Parameter

    Description

    Share Name

    The NFS mount target.

    If you use NFSv4, you can directly mount the share by using the share name. If you use NFSv3, you must obtain the mount point by using showmount -e <gateway IP address>.

    Read/Write Client IPs

    The IP addresses or CIDR blocks of clients that can read data from or write data to the NFS share.

    Example: 192.168.10.10 or 192.168.0.0/24. You can specify more than one IP address or CIDR block.

    Read-only Client IPs

    The IP addresses or CIDR blocks of clients that can only read data from the NFS share.

    Example: 192.168.10.10 or 192.168.0.0/24. You can specify more than one IP address or CIDR block.

    User Mapping

    Map an NFS client user to an NFS server user. This parameter is available only if you set Protocol to NFS.

    • none: The NFS client user is not mapped to the nobody user on the NFS server.

    • root_squash: The NFS client that uses the root identity is mapped to the nobody user on the NFS server.

    • all_squash: The NFS client is mapped to the nobody user on the NFS server regardless of the identity that the client uses.

    • all_anonymous: The NFS client is mapped to the anonymous user on the NFS server regardless of the identity that the client uses.

    Support Archive

    This parameter is available only when you set User Mapping to none for the NFS share.

    • If you want to use the archive feature, select Yes. You can use the archive feature to archive and restore files in a share.

    • If you do not need the archive feature, select No. You cannot use the archive feature to directly manage files. When you read data from an archived file, a request to restore the file is also initiated. This causes a certain level of latency before you can actually read the archived file.

    Note

    Basic file gateways do not support the archive feature.

    Enabled

    Specify whether to enable the specified NFS share.

    If you do not want to immediately use the NFS share, you can select No to disable the NFS share.

    Data Access Mode

    Select a mode for the share. You can select Replication Mode or Cache mode.

    • Replication Mode: In this mode, two backups are created for all data. One backup is stored in the on-premises cache disk and the other backup is stored in the associated OSS bucket.

    • Cache Mode: In this mode, the on-premises cache disk stores only metadata and the data that is frequently accessed. The bucket stores full data.

    Enable Reverse Sync

    Reverse synchronization allows you to synchronize metadata of objects in the OSS bucket to the on-premises cache disk. This feature is suitable for disaster recovery, data restoration, and data sharing.

    Note

    During a reverse synchronization process, the system scans all objects in the bucket. If the bucket contains a large number of objects, you are charged for calling the OSS API. For more information, see Pricing of OSS.

    Encryption Type

    Select whether to use encryption. You can select No Encryption or Server Side Encryption.

    If you select Server Side Encryption, you must set the CMK ID parameter. You can create a key in the Key Management Service (KMS). For more information, see Create a CMK.

    If you enable the OSS server-side encryption feature, you can bring your own key (BYOK). You can use keys that are imported from KMS.

    After you enable server-side encryption, files that are uploaded to OSS from the share are encrypted by using KMS-managed keys. You can call the GetObject operation to check whether the specified object is encrypted. If the value of the x-oss-server-side-encryption field is KMS and the value of the x-oss-server-side-encryption-key-id field is the key ID, the file is encrypted.

    Note
    • Only the users on the whitelist can use this feature.

    • When you create a CMK in the KMS console, you must select the region in which the OSS bucket resides.

    Bucket Name

    The OSS bucket.

    Path Prefix

    Enter a subdirectory of the bucket.

    The name of a subdirectory can contain only letters and digits.

    Note

    Starting from V1.0.38, you can map the root directory of a file system to a subdirectory of the bucket. This way, you can isolate file access requests.

    You can specify an existing subdirectory or a new subdirectory. After you create a share, the specified subdirectory serves as the root directory. All the related files and directories are stored in the root directory.

    Use Metadata

    Select whether to use metadata disks. If you use metadata disks, data disks are separated from metadata disks, and metadata disks are used to store the metadata of data in the share.

    • If you select Yes, you must set the Metadata and Data parameters.

    • If you select No, you must set the Cache Disk parameter.

    Note

    Only users on the whitelist can use this feature.

    Ignore delete

    If you select Yes, the data that is deleted from the on-premises cache disk is not deleted from the OSS bucket. The bucket stores full data.

    NFS V4 Optimization

    Select whether to optimize the upload efficiency if the share is mounted to an NFSv4 file system. If you select Yes, you cannot mount an NFSv3 file system on your on-premises host.

    Sync Delay

    Specify a period of time to delay the upload of files. This setting prevents frequent on-premises modifications from creating a large number of parts in OSS. Default value: 5. Maximum value: 120. Unit: seconds.

    Max Write Speed

    Specify the maximum write speed. Valid values: 0 to 1280. Unit: MB/s. The default value 0 indicates that the write speed is unlimited.

    Max Upload Speed

    Specify a limit on the upload speed. Valid values: 0 to 1280. Unit: MB/s. The default value 0 indicates that the upload speed is unlimited.

    Note

    When you limit the write speed and upload speed, make sure that the upload speed limit is not smaller than the write speed limit.

    Optimize Fragments

    Specify whether to optimize the performance for applications that frequently and randomly read and write small amounts of data.

    Fast Cache Reclaim

    If you select Yes, cached data is cleared in real time. This feature is suitable for cloud backup scenarios.

  5. Click OK.

Related operations

On the NFS page, you can perform the following operations.

Operation

Procedure

Disable NFS sharing

On the NFS page, you can turn off the toggle on the upper-left side of the page to disable all NFS shares of the gateway.

If you want to disable a single NFS share, you can use the following method.

On the NFS page, find the NFS share that you want to disable. Click Settings, and set Enabled to No.

Delete an NFS share

On the NFS page, find the NFS share that you want to delete, and click Delete to delete the NFS share.

Note

If the NFS share is mounted on a client, it takes a short period of time for the system to unmount the mount point after the share is deleted. During this period, if you create an NFS share with the same ID, the mount point fails to be unmounted. Therefore, after you delete an NFS share, run the df -h command to confirm that the mount point is successfully unmounted before you perform other operations.

Modify an NFS share

On the NFS page, find the NFS share that you want to modify, and click Settings or Advanced Settings to modify the NFS share.

What to do next

Access an NFS share