Mount a NAS file system automatically when you create an ECS instance.
Prerequisites
A file system is created. Create a General-purpose NAS file system.
A mount target is created. Create a mount target.
Background
The simplest way to mount a NAS file system is when you create an ECS instance. You can mount up to five file systems on a single instance.
Limitations
Automatic mounting has the following limitations:
Image: Only official images are supported. Custom images created from snapshots are not supported.
Mount path: Only the root directory of a file system can be mounted, not subdirectories.
If automatic mounting does not meet your needs, manually mount the file system after instance creation. Mount a file system on an ECS instance.
Mount a single NAS file system
Log on to the ECS console.
Create an ECS instance. Use Custom Launch to create an instance.
On the Custom Launch page, set these key parameters:
Region: Select the region of your NAS file system.
Network and Zone: Select the same VPC, vSwitch, and availability zone as your NAS file system for optimal performance.
Instance Type: Select an instance type that meets your workload requirements.
Image: Select an image. CentOS 7.6 is recommended for Linux, and Windows Server 2019 Datacenter for Windows.
Storage: In the NAS File System (Optional) section, click Add File System and configure the following parameters.
Parameter
Description
File system
Linux images require an NFS file system.
Windows images require an SMB file system.
Mount target
Provides network connectivity between NAS and ECS. Must be in the same VPC as the ECS instance.
If no options are available, create one first. Create a mount target.
Mount path
The local path where the file system is mounted. Example: /mnt for Linux or a drive letter such as Z for Windows.
Protocol type
For NFS file systems, select NFSv3 or NFSv4.0. NFSv3 is recommended unless you need file locking.
For an SMB file system, select SMB.
Mount multiple NAS file systems
Click Add File System for each file system and configure its settings:
Mount Target:
All mount targets must be in the same VPC.
If no mount targets are available in the VPC, add them to your file system first. Create a mount target.
Mount Path:
Each mount path must be unique.
For Linux images, nested paths are allowed, such as /mnt and /mnt/sub.
If you need to mount more than five file systems, submit a ticket.
Verify the mount
The NAS file system mounts automatically after instance creation and remounts on each restart. To verify:
Linux instances
Run
df -hto verify the mount.[root@xxx ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/vda1 40G 1.8G 36G 5% / devtmpfs 3.8G 0 3.8G 0% /dev tmpfs 3.8G 0 3.8G 0% /dev/shm tmpfs 3.8G 452K 3.8G 1% /run tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup xxx xxx.cn-shenzhen.nas.aliyuncs.com:/ 1.0P 1.1G 1.0P 1% /mnt tmpfs 768M 0 768M 0% /run/user/0Used shows consumed storage. Size shows total file system capacity, which is not the basis for billing.
The mount configuration is stored in /etc/fstab. To modify it, see Mount an NFS file system.
Windows instances
Open File Explorer. The mounted SMB file system appears as a network drive.
If the mapped drive does not appear, you can access it by entering its path, such as
\\<mount-target-domain>\myshare, in the File Explorer address bar. Replace<mount-target-domain>with the domain of your mount target.
The mount configuration is stored in c:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\my_mount.bat. Modify this file as needed.