All Products
Search
Document Center

Cloud Storage Gateway:Manage NFS shares

Last Updated:Sep 09, 2024

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

Prerequisites

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

  2. Cloud resources are attached 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 communications. If NFS is used, the local client directly reads files from and writes files to the remote NFS server.

Cloud Storage Gateway (CSG) operates in a similar manner to an NFS server and provides the file sharing service. Before you can use a shared directory, you must create a shared directory on the CSG, specify the users that are allowed to access the shared directory, and configure access permissions.

Install an NFS client

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

  1. Log on to the client.

  2. Use the following command to install the NFS client.

    This topic describes how to install NFS clients in Ubuntu and CentOS. For more 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. Click NFS, and click Create.

  4. In the Create NFS Share dialog box, set the parameters and click OK. The following table describes the parameters.

    Parameter

    Description

    Share Name

    The virtual mount point of the NFS share that you want to create.

    You can use this share name to mount an NFSv4 share. If you want to mount an NFSv3 share, you must run the showmount -e <IP address of the gateway> command to obtain the mount point.

    Read/Write Client IPs

    The IP address or CIDR block of the client that can read data from or write data to the NFS gateway.

    Example: 192.168.10.10 or 192.168.0.0/24. You can enter multiple IP addresses or CIDR blocks.

    Read-only Client IPs

    The IP address or CIDR block of the client that can only read data from the NFS gateway.

    Example: 192.168.10.10 or 192.168.0.0/24. You can enter multiple IP addresses or CIDR blocks.

    User Mapping

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

    • none: specifies no mapping relationship between an NFS client user and the nobody user of the NFS server.

    • root_squash: restricts the use of root user permissions. NFS clients that use the root identity are mapped to the nobody user on the NFS server.

    • all_squash: restricts the use of all user permissions. NFS clients are mapped to the nobody user of the NFS server regardless of the identity that is used by the clients.

    • all_anonymous: restricts the use of all user permissions. NFS clients are mapped to the anonymous user of the NFS server regardless of the identity that is used by the clients.

    Archive

    This parameter is available only if you set the Protocol parameter to NFS and the User Mapping parameter to none.

    • If you select Yes, the archive feature is enabled. You can archive and restore files in a share by using the archive management tool.

    • If you select No, the archive feature is disabled. You cannot use the archive management tool to manage files. If you request to read data from an archived file, the system sends a request to restore the file at the same time. No error message is returned. However, latency may exist before you can read the archived file.

    Note

    Basic file gateways do not support the archive feature.

    Enable

    Specify whether to enable the specified NFS share.

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

    Mode

    Valid values: Cache Mode and Replication Mode.

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

    • Cache Mode: In this mode, the backup that is stored on the on-premises cache disk contains only metadata and the user data that is frequently accessed. The backup that is stored in the OSS bucket contains all data.

    Reverse Sync

    Specifies whether to synchronize metadata that is stored in the OSS bucket to the on-premises cache disk. You can use this feature in scenarios in which disaster recovery, data restoration, and data sharing are required.

    Note

    In a reverse synchronization process, the system scans all objects in the bucket. If the number of objects exceeds the limit, you are charged when you call the OSS API. For more information, see OSS pricing.

    Encrypt

    Valid values: None and Server-side Encryption.

    If you select Server-side Encryption, you must set the Key ID parameter. You can create a key in the KMS console. For more information, see Create a CMK.

    After you enable the OSS server-side encryption feature, you can bring your own key (BYOK). The system supports keys that are imported from Key Management Service (KMS).

    After you enable the OSS server-side encryption feature, the system uses the imported key to encrypt files that are uploaded to OSS from the shared directory. You can call the GetObject API operation to check whether the specified file 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 in the response header, the file is encrypted.

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

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

    Bucket Name

    Select an existing bucket.

    Subdirectory

    Enter a subdirectory of the bucket.

    The Subdirectory field supports only letters and digits.

    Note

    In version 1.0.38 and later, you can map the root directory of a file system to a subdirectory of a bucket. This way, you can isolate file access requests.

    You can specify an existing subdirectory or a subdirectory that does not exist in the bucket. After you create a share, the specified subdirectory serves as the root directory, and stores all related files and directories.

    Use Metadata

    Specifies 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 shared directories.

    • 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 the users in the whitelist can use this feature.

    Ignore Deletions

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

    NFS V4 Optimization

    Specifies whether to improve the upload efficiency of NFSv4 files. If you select Yes, you cannot mount an NFSv3 file system on your on-premises host.

    Sync Latency

    Specify a synchronization latency to upload modified and closed files. The Sync Latency feature prevents OSS file fragments that are caused by frequent on-premises modifications. Default value: 5. Maximum value: 120. Unit: seconds.

    Max Write Speed

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

    Max Upload Speed

    Specify the maximum upload speed. Valid values: 0 to 1280. Unit: MB/s. Default value: 0. The value 0 indicates that the upload speed is not limited.

    Note

    When you customize the maximum write speed and upload speed, make sure that the maximum upload speed is greater than or equal to the maximum write speed.

    Fragmentation Optimization

    Specifies whether to optimize the performance for applications that frequently and randomly read and write small amounts of data. You can enable this feature based on your business requirements.

    Upload Optimization

    If you select Yes, cached data is cleared in real time. You can enable this feature if you synchronize only backups to the cloud.

  5. Click OK.

Other supported operations

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

Operation

Description

Disable NFS sharing

On the NFS page, you can click the button on the upper-left side of the page to disable NFS sharing.

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 from the client 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 from the client. Therefore, after you delete an NFS share, run the df -h command to confirm that the file 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