This topic describes how to use an access point to access a General-purpose File Storage NAS (NAS) Network File System (NFS) file system on an Elastic Compute Service (ECS) instance.
Prerequisites
A General-purpose NFS file system is created. For more information, see Create a file system.
An access point is created. For more information, see Create an access point.
A Linux ECS instance is available in the region where you create the NFS file system. The ECS instance is associated with an elastic IP address (EIP) or configured with a public IP address. For more information, see Creation methods.
Procedure
Connect to the ECS instance. For more information, see Connection method overview.
ImportantYou must download the NAS client over the Internet. Before you connect to the ECS instance, make sure that the ECS instance has been associated with an EIP or configured with a public IP address.
Install the NAS client.
Alibaba Cloud Linux
Download the NAS client.
wget https://aliyun-encryption.oss-cn-beijing.aliyuncs.com/aliyun-alinas-utils-1.3-0.20240914145556.91a304.al7.noarch.rpm
Install the NAS client.
sudo yum install aliyun-alinas-utils-*.rpm
Check whether the NAS client is installed.
which mount.alinas
If an output similar to the following example appears, the NAS client is installed.
CentOS
Download the NAS client.
CentOS 7.x
wget https://aliyun-encryption.oss-cn-beijing.aliyuncs.com/aliyun-alinas-utils-1.1-8.el7.noarch.rpm
CentOS 8.x
wget https://aliyun-encryption.oss-cn-beijing.aliyuncs.com/aliyun-alinas-utils-1.1-8.el8.noarch.rpm
Install the NAS client.
sudo yum install aliyun-alinas-utils-*.rpm
Check whether the NAS client is installed.
which mount.alinas
If an output similar to the following example appears, the NAS client is installed.
Red Hat Enterprise Linux
Download the NAS client.
Red Hat Enterprise Linux 7.x
wget https://aliyun-encryption.oss-cn-beijing.aliyuncs.com/aliyun-alinas-utils-1.1-8.el7.noarch.rpm
Red Hat Enterprise Linux 8.x
wget https://aliyun-encryption.oss-cn-beijing.aliyuncs.com/aliyun-alinas-utils-1.1-8.el8.noarch.rpm
Install the NAS client.
sudo yum --disablerepo=rhui-rhel-7-server-rhui-extras-debug-rpms install aliyun-alinas-utils-*.rpm
Check whether the NAS client is installed.
which mount.alinas
If an output similar to the following example appears, the NAS client is installed.
Ubuntu and Debian
Download the NAS client.
wget https://aliyun-encryption.oss-cn-beijing.aliyuncs.com/aliyun-alinas-utils-1.1-8.deb
Install the NAS client.
sudo apt update sudo dpkg -i aliyun-alinas-utils-*.deb sudo apt-get install -f sudo dpkg -i aliyun-alinas-utils-*.deb
Check whether the NAS client is installed.
which mount.alinas
If an output similar to the following example appears, the NAS client is installed.
Mount the NFS file system.
No RAM policy is enabled for the access point
NFSv3
sudo mount -t alinas -o tls,vers=3 <access-point>:/ /mnt
NFSv4.0
sudo mount -t alinas -o tls,vers=4.0 <access-point>:/ /mnt
The following table describes the parameters.
Parameter
Description
tls
Enables Transport Layer Security (TLS).
ImportantTo use an access point to access a file system, you must enable TLS.
<access-point>:/
Indicates <Domain name of the access point>:<Relative path of the access point>. Replace the variables with the actual values.
Domain name of the access point: You can perform the following operations to obtain the domain name of an access point: Log on to the NAS console. Choose File System > File System List. On the File System List page, click Manage in the Actions column of the file system. On the Mount Targets tab, click the Access Point tab and obtain the domain name of the access point. For more information, see View the domain name of an access point. Example:
ap-BLC2mN****.9e7de4b923-efr27.cn-zhangjiakou.nas.aliyuncs.com
.Relative path of the access point: Enter
/
.NoteFor example, when you create an access point, if you set the root directory of the access point to
/test
, the access point is directly mounted to the/test
directory of the NAS file system by using/
. If you set the value to another relative path/path/to/dir
, the access point is mounted to the/test/path/to/dir
directory of the NAS file system. Make sure that the/test/path/to/dir
directory already exists in the NAS file system.
/mnt
The mount directory that resides on the current ECS instance.
The value is a subdirectory such as /mnt of a Linux ECS instance. Make sure that the subdirectory exists in the on-premises file system.
A RAM policy is enabled for the access point
Configure the Resource Access Management (RAM) information.
Create the
/etc/aliyun/alinas/.credentials
file.touch /etc/aliyun/alinas/.credentials
Run the
vi /etc/aliyun/alinas/.credentials
command to open the/etc/aliyun/alinas/.credentials
file and add the following content:RAM user
[NASCredentials] accessKeyID = your_accesskey_id accessKeySecret = your_accesskey_secret
Replace
your_accesskey_id
andyour_accesskey_secret
with your AccessKey ID and AccessKey secret. The policy for the access point client has been attached to the RAM user. For more information, see (Optional) Configure a policy for the access point client. For information about how to obtain an AccessKey pair, see How do I obtain an AccessKey pair?RAM role
[NASCredentials] accessKeyID = your_accesskey_id accessKeySecret = your_accesskey_secret securityToken = your_security_token
Replace
your_accesskey_id
,your_accesskey_secret
, andyour_security_token
with your AccessKey ID, AccessKey secret, and Security Token Service (STS) token used to assume the RAM role, respectively. The policy for the access point client has been attached to the RAM user. For more information, see (Optional) Configure a policy for the access point. You can call the AssumeRole operation to obtain the STS token, AccessKey ID, and AccessKey secret of the RAM role.
Mount the NFS file system.
NFSv3
sudo mount -t alinas -o tls,vers=3,ram <access-point>:/ /mnt
NFSv4.0
sudo mount -t alinas -o tls,vers=4.0,ram <access-point>:/ /mnt
The following table describes the parameters.
Parameter
Description
tls
Enables TLS.
ImportantTo use an access point to access a file system, you must enable TLS.
ram
Uses the configured RAM information to mount the file system. The RAM information is generally stored in the
/etc/aliyun/alinas/.credentials
path. If you need to change the path, change theram
parameter toram_config_file=The specified path
.<access-point>:/
Indicates <Domain name of the access point>:<Relative path of the access point>. Replace the variables with the actual values.
Domain name of the access point: You can perform the following operations to obtain the domain name of an access point: Log on to the NAS console. Choose File System > File System List. On the File System List page, click Manage in the Actions column of the file system. On the Mount Targets tab, click the Access Point tab and obtain the domain name of the access point. For more information, see View the domain name of an access point. Example:
ap-BLC2mN****.9e7de4b923-efr27.cn-zhangjiakou.nas.aliyuncs.com
.Relative path of the access point: Enter
/
.NoteFor example, when you create an access point, if you set the root directory of the access point to
/test
, the access point is directly mounted to the/test
directory of the NAS file system by using/
. If you set the value to another relative path/path/to/dir
, the access point is mounted to the/test/path/to/dir
directory of the NAS file system. Make sure that the/test/path/to/dir
directory already exists in the NAS file system.
/mnt
The mount directory that resides on the current ECS instance.
The value is a subdirectory such as /mnt of a Linux ECS instance. Make sure that the subdirectory exists in the on-premises file system.
Verify the mount result.
Command
mount -l
Sample output
If a command output similar to the following example appears, the mount is successful.
After the file system is mounted, you can run the
df -h
command to view the storage capacity of the file system.If the file system fails to be mounted, troubleshoot the issue. For more information, see Troubleshoot mount issues for access points.
After the file system is mounted, you can view data of, read data from, and write data to the NAS file system on the Linux ECS instance. Sample commands:
mkdir /mnt/dir1 mkdir /mnt/dir2 touch /mnt/file1 echo 'some file content' > /mnt/file2 ls /mnt
Optional. Configure automatic mounting at startup.
When you restart the ECS instance on which the file system is mounted, the information about all the mounted file systems may be lost. To prevent the loss of such information, you can edit the /etc/fstab configuration file on the Linux ECS instance to enable automatic mounting of the NFS file system at startup.
Open the /etc/fstab configuration file to add mounting configurations.
If the RAM policy is not enabled for the access point, run the following command:
access-point:/ /mnt alinas _netdev,tls,vers=3 0 0
If the RAM policy is enabled for the access point, run the following command:
access-point:/ /mnt alinas _netdev,tls,vers=3,ram 0 0
For more information, see Mount parameters. The following table describes the parameters that are used in the preceding examples.
Parameter
Description
_netdev
Prevents automatic mounting before the network is connected.
vers
The protocol version of the file system.
vers=3: uses NFSv3 to mount the file system.
vers=4.0: uses NFSv4 to mount the file system.
0 (the first value after ram)
Specifies whether to back up the file system by running the dump command. A non-zero value indicates that a file system is backed up. The default value is 0 for NAS file systems.
0 (the second value after ram)
Specifies the order in which the fsck command checks a file system at startup. The default value is 0 for NAS file systems. The default value 0 indicates that the fsck command is not run at startup.
Run the
reboot
command to restart the ECS instance.NoteBefore you restart the ECS instance, make sure that the manual mounting is successful. Otherwise, the ECS instance may fail to restart. If automatic mounting is enabled, after the ECS instance is restarted, you can run the
df -h
command to view the mounted NAS file systems.
Troubleshoot mount issues for access points
What do I do if mount: unknown filesystem type 'alinas'
is returned when I mount a file system?
Reinstall the client alinas-utils. For more information, see Install the NAS client.
What do I do if mount.nfs: an incorrect mount option was specified
is returned when I mount a file system?
Cause
The mount command is incorrect or the NAS client version is outdated.
Solution
Check whether the parameter values in the mount command are correct. For more information, see Mount the NFS file system.
Run the following command to check the version of the NAS client. If the version is earlier than 1.1-8, upgrade the NAS client to the latest version.
rpm -qa | grep alinas
What do I do if mount.nfs: Unknown error 521
is returned when I mount a file system?
Cause
The domain name of the access point is incorrect.
The permission group configuration of the access point is incorrect.
After the RAM policy is enabled, the RAM policy is not configured or the AccessKey ID or AccessKey secret is incorrectly configured in the .credential configuration file.
The STS token has expired.
Solution
Check whether the domain name specified in the mount command is correct.
For more information about how to view the domain name of an access point, see View the domain name of an access point.
Check the permission group configuration of the access point.
You can click Manage in the Actions column of the access point on the Access Point tab to go to the access point details page and view the permission group to which the access point belongs. For more information about permission groups, see Manage permission groups.
If the RAM policy is enabled for the access point, perform the following operations:
Check whether the mount command contains the
ram
parameter. Sample mount commands:NFSv3
sudo mount -t alinas -o tls,vers=3,ram <access-point>:/ /mnt
NFSv4.0
sudo mount -t alinas -o tls,vers=4.0,ram <access-point>:/ /mnt
Check whether the AccessKey pair configured for the RAM user is correct.
For more information about how to configure the RAM information, see Configure the RAM information.
Check whether the nas:ClientMount permission on the access point is granted to the RAM user and whether the policy for the access point client is correct.
For more information about the policy for the access point client, see Configure a policy for the access point client.
If you use an STS token to access the file system, check whether the STS token has expired.
What to do next
Unmount a file system. For more information, see Unmount a file system from a Linux ECS instance.
Configure directory quotas. For more information, see Manage directory quotas.
Enable an NFS access control list (ACL). For more information, see File Storage NAS NFS ACLs.
Back up data in a file system. For more information, see Back up files from a General-purpose NAS file system.