Before you can access an Apsara File Storage NAS file system, you must create a NAS file system and mount the file system on an Elastic Compute Service (ECS) instance. This topic describes how to create a General-purpose 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). After you mount the file system on the instance, you can 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 General-purpose NAS File System.
- On the buy page of General-purpose NAS file systems, set the parameters. The following table describes the parameters. For the parameters
that are not described in the following table, select values based on your business
requirements or use the default values.
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 follow the on-screen instructions to complete the payment. After you purchase the file system, a mount target is automatically generated for the file system and a permission group named "VPC default permission group (all allowed)" is attached to the mount target. You can also create permission groups and add mount targets based on business scenarios. For more information, see Create a permission group and add rules for the permission group and Create a mount target.
- Go to the NAS console. In the left-side navigation pane, choose and click the name of the file system that you created.
- On the details page of the file system, click Mount Targets.
- On the Mount Target tab, copy the mount command for later use.
Step 2: Mount the file system
- Connect to the ECS instance. For more information, see Connection methods.
- Run the following command to install an NFS client:
sudo yum install nfs-utils
- Run the following code to set the number of concurrent NFS requests to
if (lsmod | grep sunrpc); then (modinfo sunrpc | grep tcp_max_slot_table_entries) && sysctl -w sunrpc.tcp_max_slot_table_entries=128 (modinfo sunrpc | grep tcp_slot_table_entries) && sysctl -w sunrpc.tcp_slot_table_entries=128 fi (modinfo sunrpc | grep tcp_max_slot_table_entries) && echo "options sunrpc tcp_max_slot_table_entries=128" >> /etc/modprobe.d/alinas.conf (modinfo sunrpc | grep tcp_slot_table_entries) && echo "options sunrpc tcp_slot_table_entries=128" >> /etc/modprobe.d/alinas.conf
- Run the mount command that you copied in Step 1.
- Run the
mount -lcommand to view the mount result.The command output in the following figure indicates a successful mount. After the file system is mounted, you can run the
df -hcommand to view the capacity of the file system.
If the file system fails to be mounted, troubleshoot the issue. For more information, see Fix mount issues.