By Alain Francois
Network Attached Storage (NAS) is a reliable service that provides standard file access protocols and guarantees high throughput and low latency. It provides simple, scalable, and shared file storage for compute nodes, including Elastic Compute Service (ECS) instances, E-HPC nodes, and Alibaba Cloud Container Service for Kubernetes (ACK) nodes. NAS is compatible with multiple standard protocols, such as NFS and SMB. This means you do not have to modify existing applications; Windows and Linux applications can use NAS. Alibaba Cloud File Storage NAS can allow simultaneous access to a file system from multiple ECS instances. It provides mount points that connect to Alibaba Cloud Elastic Compute Service (ECS) nodes residing on virtual private clouds (VPCs).
File Storage NAS offers three storage types:
This guide uses the General-Purpose NAS file systems for the demo. It consists of NAS Performance file systems and NAS Capacity file systems. You can look at both types and choose which one fits your requirements:
Log in to your Alibaba Cloud console and go to Storage → File Storage NAS:
The overview page explains the different types of storage. You can choose one that fits your needs:
Go to File System List to create the file storage:
Choose Create File System. In the new window, create the General-Purpose NAS file systems:
You will need to set up some configurations, including the region where you want to create your NAS File System.
Note: Capacity NAS and Performance NAS are not available as storage types for all regions. Some regions only propose one type of storage.
In our case, we will choose NFS since we will test on a Linux client.
You can encrypt it for more security and create a data backup. However, we will explain how to create a backup in this guide:
When configuring NAS, you need to set up the mount target. You can configure the mount target for a VPC or a classic network. If a NAS file system and multiple ECS instances reside in the same VPC, you can only mount the file system on a Linux ECS instance. In our case, we will configure it for the VPC of our ECS:
Next, you will get a summary of your configuration:
After completing your order, go back to File System List. You will see your File NAS storage:
The mount target was created automatically when configuring the network:
Connect to your Linux ECS instance and install an NFS client:
$ sudo apt update && sudo apt install nfs-common -y
$ sudo yum install nfs-utils -y
Increase the number of concurrent NFS requests by running the following two commands:
$ echo "options sunrpc tcp_slot_table_entries=128" | sudo tee /etc/modprobe.d/sunrpc.conf
$ echo "options sunrpc tcp_max_slot_table_entries=128" | sudo tee /etc/modprobe.d/sunrpc.conf
Mount the NFS file system. The command is listed below:
$sudo mount -t nfs -o vers=4,minorversion=0,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport file-system-id.region.nas.aliyuncs.com:/ /mnt
You need to have the values of file-system-id
and region
. Click on your file system created and go to the mount target section to create a query:
On the Action section, choose Query:
Select your instance for the query:
You will see a summary of the query:
You will see a new option that will give you some information to connect to the file system. Choose Mount a file system on ECS by running the command to get the procedure and the other information to mount the NFS system:
You may need to mount the file system so multiple ECS instances can edit a file at the same time. Choose the option that fits your needs and execute the command it shows:
Use the information we have so far and the command below to mount your NFS file system using the NFSv4 protocol:
$ sudo mount -t nfs -o vers=3,nolock,proto=tcp,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 11d5994875d-rfh96.eu-central-1.nas.aliyuncs.com:/ /mnt
You can check if the file system has been mounted with the df
command:
$ df -h
We possess two Linux ECS instances, Ubuntu and CentOS. We have mounted the NFS file system on Ubuntu. Now, create a file and see if the other instance can see it after mounting the NFS file system.
Let's create a folder inside the mounted file system on our Ubuntu instance:
$ mkdir /mnt/shared-folder
Let's create a file inside the folder and put a content:
$ vim /mnt/shared-folder/test-file
Let's mount the NFS file system on the CentOS ECS instance:
$ sudo mount -t nfs -o vers=3,nolock,proto=tcp,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 11d5994875d-rfh96.eu-central-1.nas.aliyuncs.com:/ /mnt/nfs1
Let's check the mounted file system:
$ tree /mnt
You can see the shared file system and its content.
When you create a NAS file system on a VPC, all your running instances on the same VPC can access your NFS shared file system. Linux distributions, such as CoreOS, FreeBSD, and Fedora CoreOS, do not support the mount feature of the NAS console.
1,042 posts | 256 followers
FollowAlibaba Cloud Community - February 21, 2022
Alibaba Developer - February 7, 2022
Alibaba Clouder - July 31, 2020
Alibaba Clouder - June 16, 2020
Rupal_Click2Cloud - August 26, 2022
Rupal_Click2Cloud - September 21, 2022
1,042 posts | 256 followers
FollowSimple, scalable, on-demand and reliable network attached storage for use with ECS instances, HPC and Container Service.
Learn MorePlan and optimize your storage budget with flexible storage services
Learn MoreBuild your cloud drive to store, share, and manage photos and files online for your enterprise customers
Learn MoreA cost-effective, efficient and easy-to-manage hybrid cloud storage solution.
Learn MoreMore Posts by Alibaba Cloud Community