All Products
Search
Document Center

Apsara File Storage NAS:Mount a file system on a Linux ECS instance

Last Updated:Jun 11, 2024

Before you can access data in Apsara File Storage NAS (NAS), 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 and use the mount feature in the console to mount the NFS file system on an ECS instance running CentOS 7.9 to upload and download data.

Prerequisites

  • NAS is activated.

    The first time you visit the product page of NAS, follow the instructions to activate the NAS service.

  • An ECS instance is created in the China (Hangzhou) region. The operating system of the instance is CentOS 7.9. For more information, see Create an ECS instance.

Step 1: Create an NFS file system

  1. Log on to the NAS console.

  2. In the lower part of the Overview page, click Create General-purpose NAS File System.

  3. On the General-purpose NAS (Pay-as-you-go) page, configure 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.

    For more information, see Create a file system.

    Parameter

    Description

    Region

    Select China (Hangzhou).

    Zone

    Select Hangzhou Zone F. The file system and the ECS instance must reside in the same zone.

    Protocol Type

    Select NFS.

    Network Type

    Select VPC.

    VPC

    Select the virtual private cloud (VPC) where the ECS instance resides.

    vSwitch

    Select a vSwitch that resides in the VPC.

  4. Click Buy Now and follow the instructions to complete the payment.

    Note
    • A permission group named "VPC default permission group (all allowed)" is generated for each Alibaba Cloud account. All IP addresses in the VPC are allowed to access the file system by using the mount target of the file system. You can also create a permission group based on your business scenario. For more information, see Manage permission groups.

    • For a General-purpose NAS file system, a mount target is automatically generated and the "VPC default permission group (all allowed)" is attached to the mount target. For an Extreme NAS file system, you must manually create a mount target. For more information, see Create a mount target.

Step 2: Mount the file system in the NAS console

  1. In the left-side navigation pane, choose File System > File System List.

  2. In the top navigation bar, select a region.

  3. Find the file system that you created and click Mount in the Actions column.

    Note

    The first time you use the mount feature in the NAS console, you must assign the AliyunServiceRoleForNasEcsHandler service-linked role to NAS. Follow the instructions in the dialog box to complete authorization. For more information, see Service-linked roles of NAS.

  4. In the Mount panel, perform the configurations to mount the file system.

    1. Select a mount target and click Next.

    2. Select an ECS instance and click Next.

      The selected ECS instance must reside in the same VPC as the file system. Otherwise, NAS prompts that the network may be disconnected. Proceed with caution.

      Note
    3. Mount the file system on the ECS instance.

      Parameter

      Description

      Mount Path

      Enter the local path of the ECS instance on which you want to mount the file system.

      Automatic Mount

      By default, Automatic Mount at Startup is selected. When you restart the ECS instance, you do not need to re-mount the file system.

      Protocol Type

      Select the protocol type of the file system.

      • General-purpose NAS file systems support NFSv3 and NFSv4. If you do not need to modify the same NAS file on multiple ECS instances at a time, we recommend that you select NFSv3 to ensure optimal performance.

      • Extreme NAS file systems support only NFSv3.

      NAS Directory

      Enter the directory of the NAS file system.

      You can enter the root directory / or a subdirectory, for example, /abc.

      Note

      If the directory does not exist, you can select Confirm New Directory to create a directory in the file system. In addition, you must configure the user identifier (UID), group identifier (GID), and POSIX permissions for creating the directory. Otherwise, the default values and default permissions are used to create the directory.

      Mount Parameters

      We recommend that you use the default mount parameters. For more information, see the mount parameters described in Mount an NFS file system on a Linux ECS instance.

  5. Click Complete.

    The mount takes about 1 to 2 minutes. If the mount status is Mounted, the NAS file system is mounted on the ECS instance.

    image

    If the mount status is Failed, you can use the troubleshooting tool to troubleshoot the issue. For more information, see Mount an NFS file system on a Linux ECS instance.

    After the file system is mounted, you can connect to the ECS instance and run the mount -l or df -h command to view the mount parameters or the capacity of the file system.

Step 3: Use the file system

After you mount the file system on the ECS instance, you can access the file system the same way you access a local directory. The following figure shows an example.

  1. Remotely connect to the ECS instance by referring to Connection methods, and run the following commands to access the file system:

    mkdir /mnt/dir1
    mkdir /mnt/dir2
    touch /mnt/file1
    echo 'some file content' > /mnt/file2
    ls /mnt
  2. If an output similar to the following example appears, you have accessed the General-purpose Capacity NFS file system.

    image..png

References