edit-icon download-icon

Mount a file system

Last Updated: Mar 29, 2018

Prerequisites

For an ECS instance to access a file system through a mount point, the following conditions must be noted:

  • For a VPC type mount point, only ECS instances within the same VPC can mount it. In addition, the VPC IP address of the ECS instance must be in the authorized addresses of the mount point`s permission group.

  • For a classic network type mount point, only ECS instances under the same account can mount it. In addition, the intranet IP address of the ECS instance must be in the authorized addresses of the mount point`s permission group.

For more information, see Use permission groups.

Mount a file system

If you want to mount an NFS file system, make sure that your system has installed nfs-utils or nfs-common. The installation method is as follows:

  • For CentOS
    1. sudo yum install nfs-utils
  • For Ubuntu or Debian
    1. sudo apt-get install nfs-common

NAS supports NFSv3, NFSv4, and SMB2.0 or later. When mounting a file system, select the protocol version as needed.

Use the NFSv4 protocol

The command is as follows.

  1. sudo mount -t nfs -o vers=4.0 <mount point domain name>:<file system directory> <target directory>

Note: The vers parameter may be different, which is decided by the client version. If an error occurs when you use vers=4.0, replace it with vers=4.

Description:

  • Mount point domain name: when you Add a mount point, a domain name is automatically generated for the mount point. You can view it on the File System Details page.

  • File system directory: the NAS file system directory. It can be the root directory / of the NAS file system or any subdirectory.

  • Target directory: the target directory to be mounted to on the current server.

Example

To mount the NAS root directory, run the following command.

  1. mount -t nfs4 014544bbf6-wdt41.cn-hangzhou.nas.aliyuncs.com:/ /local/mntdir

To mount the NAS subdirectory sub1, run the following command.

  1. mount -t nfs4 014544bbf6-wdt41.cn-hangzhou.nas.aliyuncs.com:/sub1 /local/mntdir

Use the NFSv3 protocol

The command is as follows.

  1. sudo mount -t nfs -o vers=3,nolock,proto=tcp < mount point domain name >:< file system directory > < target directory >

Example

To mount the NAS root directory, run the following command.

  1. mount -t nfs -o vers=3,nolock,proto=tcp 014544bbf6-wdt41.cn-hangzhou.nas.aliyuncs.com:/ /local/mntdir

To mount the NAS subdirectory sub1, run the following command.

  1. mount -t nfs -o vers=3,nolock,proto=tcp 014544bbf6-wdt41.cn-hangzhou.nas.aliyuncs.com:/sub1 /local/mntdir

Use the SMB protocol

The command to be used in Windows Command Prompt or Powershell is as follows.

  1. net use < target disk drive letter > \\< mount point domain name >\myshare

Description:

  • Target disk drive letter: the target disk drive letter to be mounted to on the current Windows server. Spaces are required between use, drive letter, and \\.

  • Mount point domain name: when you add a mount point, a domain name is automatically generated for the mount point. You can view it on the File System Details page.

  • myshare: the fixed SMB share name. This cannot be changed.

Example

To mount an SMB file system to Drive Z, run the following command.

  1. C:\> net use z: \\014544bbf6-wdt41.cn-hangzhou.nas.aliyuncs.com\myshare

To use access mode, enter the following directly in the file explorer address bar.

  1. \\< mount point domain name >\myshare

View mount point information

After you mount a file system, you can view the mounted file system on your local server.

  • Use the following command to view the mount point.

    1. mount -l
  • Use the following command to view the current capacity of the mounted file system.

    1. df -h
  • For the SMB file system, use the following command in Windows Command Prompt or Powershell to view your mounted file system.

    1. net use
Thank you! We've received your feedback.