All Products
Search
Document Center

Cloud Storage Gateway:Access an NFS share

Last Updated:Jun 20, 2026

This topic explains how to access an on-premises file gateway from a Linux client.

Prerequisites

You must have an existing NFS share. For more information, see Install an NFS client.

Background

  • To access an on-premises file gateway from a Linux client, you must mount its NFS share to a local directory. This process maps the NFS share to your client, letting you treat it as a local directory.

  • In a Linux operating system, you can mount an NFS file system manually or automatically. To ensure the mount persists after a client restart, we recommend that you configure an automatic mount after a successful manual mount.

Manually mount an NFS share

  1. Log on to your local Linux client.

  2. Mount the share to a local directory on the client.

    Note

    Command parameters:

    • 192.168.0.0:/shares: The mount target for the Cloud Storage Gateway, which consists of the gateway's IP address and the share name. You can find the mount target on the share page of your target gateway in the Cloud Storage Gateway console.

    • local-directory: An existing local directory on the client where you have read and write permissions.

    • To mount the share using the NFSv4 protocol, run the following command:

      sudo mount -t nfs -o vers=4.0,nolock,proto=tcp,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 192.168.0.0:/shares local-directory
    • To mount the share using the NFSv3 protocol, perform the following steps:

      1. Run the following command to obtain the mount target.

        showmount -e <gateway-ip-address>
      2. Run the following command to mount the share. The example assumes the mount target is 192.168.0.0:/shares.

        sudo mount -t nfs -o vers=3,nolock,proto=tcp,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 192.168.0.0:/shares local-directory
  3. Run the df -h command to check the mount result.

    If the output is similar to the following, the mount is successful.

    Note

    After a successful mount, the displayed capacity is 256 TB. This value represents the maximum size of the gateway's virtual file system and does not reflect the actual storage capacity of the underlying OSS bucket, which is virtually unlimited.

    [root@centos7cb ~]# df -h
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/vda1        99G  1.6G   92G   2% /
    devtmpfs         24G     0   24G   0% /dev
    tmpfs            24G     0   24G   0% /dev/shm
    tmpfs            24G  424K   24G   1% /run
    tmpfs            24G     0   24G   0% /sys/fs/cgroup
    tmpfs           4.8G     0  4.8G   0% /run/user/0
    xxx:/nfs2  256T     0  256T   0% /mnt/nfs172cent7.4
    [root@centos7cb ~]#
  4. Access the share.

    Once mounted, you can treat the share as a local directory. Your access is determined by your read and write permissions.

    Note

    A share is synchronized with its associated OSS bucket. Operations performed on a share are synchronized to the objects in the associated bucket.

Automatically mount an NFS share

To ensure the NFS mount persists after a client restart, configure an automatic mount by adding it to the /etc/fstab (recommended) or /etc/rc.local file.

Important

Before you configure an automatic mount, make sure the manual mount is successful to prevent client startup failures.

  1. Add the mount configuration.

    • Method 1 (Recommended): Open the /etc/fstab configuration file and add the mount configuration.

      Note

      If you are configuring an automatic mount on a CentOS 6.x system, you must first perform the following steps:

      1. Run the chkconfig netfs on command to enable netfs to start on boot.

      2. Open the /etc/netconfig configuration file and comment out the inet6-related content.

      • To mount the file system using the NFSv4 protocol, add the following configuration:

        192.168.0.0:/shares local-directory nfs vers=4.0 defaults 0 0
      • To mount the file system using the NFSv3 protocol, add the following configuration:

        192.168.0.0:/shares local-directory nfs vers=3.0 defaults 0 0
      Note

      Command parameters:

      • 192.168.0.0:/shares: The mount target for the Cloud Storage Gateway, which consists of the gateway's IP address and the share name. You can find the mount target on the share page of your target gateway in the Cloud Storage Gateway console.

      • local-directory: An existing local directory on the client where you have read and write permissions.

    • Method 2: Open the /etc/rc.local configuration file and add the mount configuration.

      Note

      Before you configure the /etc/rc.local file, make sure the user has execute permissions on the /etc/rc.local and /etc/rc.d/rc.local files. For example, on CentOS 7.x systems, users do not have execute permissions by default.

      • To mount the file system using the NFSv4 protocol, add the following mount command:

        sudo mount -t nfs -o vers=4.0,nolock,proto=tcp,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 192.168.0.0:/shares local-directory
      • To mount the file system using the NFSv3 protocol, add the following mount command:

        sudo mount -t nfs -o vers=3,nolock,proto=tcp,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 192.168.0.0:/shares local-directory
      Note

      Command parameters:

      • 192.168.0.0:/shares: The mount target for the Cloud Storage Gateway, which consists of the gateway's IP address and the share name. You can find the mount target on the share page of your target gateway in the Cloud Storage Gateway console.

      • local-directory: An existing local directory on the client where you have read and write permissions.

      • To mount the file system using the NFS v4 protocol, run the following command:

        sudo mount -t nfs -o vers=4.0,nolock,proto=tcp,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 192.168.0.0:/shares local-directory
      • To mount the file system using the NFS v3 protocol, run the following command:

        sudo mount -t nfs -o vers=3,nolock,proto=tcp,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 192.168.0.0:/shares local-directory
  2. Run the reboot command to restart the client.

  3. Run the df -h command to check the mount result.