Before you access an Apsara File Storage NAS file system, you must create a NAS file system and mount the file system to an Elastic Compute Service (ECS) instance. This topic describes how to create a Network File System (NFS) file system in the NAS console. This topic also describes how to mount the NFS file system on an ECS instance of CentOS 8.2 in a virtual private cloud (VPC). You can then upload data to or download data from the file system.
Step 1: Create an NFS file system and create a mount target for the file system
- Log on to the NAS console.
- In the File System Selection Guide section of the Overview page, click Create a Common NAS File System.
- On the Create a Common NAS File System page, set the required parameters. The following table describes the parameters.
For other parameters, select values based on your business requirements or use the
Parameter Description Region Select China (Hangzhou). Zone Select Hangzhou Zone B. Select the zone where the ECS instance resides. Protocol Type Select NFS. Network Type Select VPC. VPC Select the VPC where the ECS instance resides. VSwitch Select a vSwitch that resides in the VPC.
- Click Buy Now and complete the payment as prompted.
Step 2: Mount the file system
- Connect to the ECS instance. For more information, see Guidelines on instance connection.
- Run the following command to install an NFS client:
sudo yum install nfs-utils
- Run the following command to set the number of concurrent NFS requests to
sudo echo "options sunrpc tcp_slot_table_entries=128" >> /etc/modprobe.d/sunrpc.conf sudo echo "options sunrpc tcp_max_slot_table_entries=128" >> /etc/modprobe.d/sunrpc.conf
- Run the following command to mount the file system by using the NFSv3 protocol:
file-system-id.region.nas.aliyuncs.com:/ /mnt is in the format of <Domain name of the mount target>:<Mount directory of the file system><Path of the mount directory>. Replace the values based on your actual scenarios.
sudo mount -t nfs -o vers=3,nolock,proto=tcp,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport file-system-id.region.nas.aliyuncs.com:/ /mnt
- Run the
mount -lcommand to view the mount result.