This topic describes how to access a Network File System (NFS) share from a Linux
Elastic Compute Service (ECS) instance. This requires a client installed on the ECS
instance.
Prerequisites
An NFS share is created. For more information, see
Create a share.
Manually mount an NFS share
- Log on to the ECS console.
- Connect to your Linux ECS instance. For more information, see Connect to an instance.
- From the ECS instance, run the following command to mount an NFS share to a local
directory of the client:
Note
- You can mount a share over IPv6 only in the China (Hohhot) region. Make sure that
the virtual private cloud (VPC) and vSwitch of the gateway support IPv6.
- If you want to mount a share over IPv6, make sure that an IPv6 address is configured
for the client on the ECS instance.
- If the VPC and vSwitch of an existing gateway support IPv6, you can obtain an IPv6
mount target after you enable IPv6 support for the gateway. By default, the gateways
created in this VPC support IPv6.
Parameters in the preceding commands:
- Run the df -h command to check the mount result.
If the returned result is similar to the following output, the NFS share is mounted
to the local directory of the client.

Note After the NFS share is mounted, you can view the capacity of the file system that
is managed by the NFS share. Object Storage Service (OSS) provides unlimited storage
capacity. For the file system capacity supported for individual gateway specifications,
see
Specifications.
Access an NFS share
After an NFS share is mounted, you can access the NFS share in the same way that you
access a local directory. If you have write permissions on the NFS share, you can
write data to the NFS share. If you have read-only permissions on the NFS share, you
can only read data from the NFS share.
Note A share of a gateway is synchronized with the OSS bucket associated with the share.
When you manage a share, the changes to the share are also applied to the associated
OSS bucket.
Enable automatic mounting of an NFS share
If you restart the ECS instance on which an NFS file system is mounted, the mount
information about the file system may be lost. To prevent this issue, you can modify
the /etc/fstab or /etc/rc.local configuration file on the Linux ECS instance to enable automatic mounting at instance
startup. We recommend that you use the /etc/fstab file.
Note Before you enable automatic mounting, make sure that the preceding manual mounting
is successful. This prevents startup failures of the ECS instance.
- Open the configuration file and add the mount command.
- Method 1 (recommended): Open the /etc/fstab file and add the mount command.
Note If you enable automatic mounting in CentOS 6, perform the following steps first:
- Run the
chkconfig netfs on
command to enable the NetFS service to start at system startup.
- Open the /etc/netconfig file and comment out inet6-related information.
- To use NFSv4 to mount the file system, add the following command:
- To use NFSv3 to mount the file system, add the following command:
- Method 2: Open the /etc/rc.local file and add the mount command.
Note Before you configure the rc.local file in the /etc/ directory, make sure that you have execute permissions on the rc.local file in the /etc/ directory and the rc.local file in the /etc/rc.d/ directory. For example, in CentOS 7.x, execute permissions
are not granted by default. Before you edit the rc.local file in the /etc/ directory, make sure that you are granted execute permissions.
- To use NFSv4 to mount the file system, add the following command:
- To use NFSv3 to mount the file system, add the following command:
- To mount the file system over IPv4, run the following command:
sudo mount -t nfs -o vers=3,proto=tcp,nolock 192.168.0.0:/shares local-directory
- To mount the file system over IPv6, run the following command:
sudo mount -t nfs -o vers=3,proto=tcp,nolock [2408:4004:ffff:ffff:ffff:ffff:ffff:ffff]:/shares local-directory
Parameters in the preceding commands:
- Run the reboot command to restart the ECS instance.