Help Center/ Scalable File Service/ Getting Started/ Mounting and Using a General-Purpose File System on Linux ECSs
Updated on 2026-01-13 GMT+08:00

Mounting and Using a General-Purpose File System on Linux ECSs

Scenarios

To use a general-purpose file system for file sharing, you need to create a general-purpose file system and mount it on multiple servers.

This section describes how to create an NFS general-purpose file system on the SFS console and mount it to Linux ECSs for file upload and download.

Operation Process

Procedure

Description

Preparations

Sign up for a HUAWEI ID and enable Huawei Cloud services, complete real-name authentication, and top up your account. Create a VPC endpoint, a VPC, and ECSs.

Step 1: Creating a General-Purpose File System

Create a general-purpose file system.

Step 2: Mounting the General-Purpose File System

Mount the general-purpose file system to the ECSs.

Step 3: Using the General-Purpose File System

Use the general-purpose file system for file upload and download.

Preparations

  1. Sign up for a HUAWEI ID and complete real-name authentication.

    Before purchasing SFS, sign up for a HUAWEI ID, enable Huawei Cloud services, and complete real-name authentication.

    If you have enabled Huawei Cloud services and completed real-name authentication, skip this step.

  2. Add a credit card to your account.

    Ensure that your account has sufficient balance or has a valid payment method configured. For details, see Payment.

  3. Create a VPC endpoint.

    Before mounting a general-purpose file system, ensure that a VPC endpoint is created. For details, see Configuring a VPC Endpoint.

  4. Create a VPC and ECSs.

    Before creating a general-purpose file system, check whether a VPC and ECSs are available, and whether the ECSs are in this VPC. If they are in different VPCs, you can establish communication between SFS and the ECSs using VPC peering connections. For details, see section "VPC Peering Connection".

    • Create a VPC.

    Create a VPC by referring to Creating a VPC with a Subnet.

    • Create ECSs.

    Buy ECSs in EU-Dublin in the created VPC by referring to Purchasing and Using a Linux ECS.

Step 1: Creating a General-Purpose File System

File systems are containers that store files in SFS. You need to create a general-purpose file system before storing data in SFS.

This example covers only some key parameters settings. Retain the default values for other parameters. For more information, see Creating a General-Purpose File System.

  1. Log in to the SFS console.
  2. In the upper right corner of the page, click Create File System.
  3. Configure the parameters based on Table 1.

    Table 1 Parameters for creating a general-purpose file system

    Parameter

    Example

    Description

    Replicate Existing File System Settings

    -

    Optional. Click Select Source File System. On the displayed page, select a source general-purpose file system from the list. After you click OK, the system automatically copies the region, AZ, protocol, authorization, and tags of the source file system.

    You can change some or all of the replicated settings, if needed.

    Region

    EU-Dublin

    The region where the tenant belongs.

    Select the region where the ECSs and VPC endpoint reside.

    AZ

    AZ1

    An AZ is a physical location that uses independent power supply and networks. AZs in the same region can communicate with each other over an intranet.

    For low network latency, you are advised to select the same AZ where the ECSs reside.

    Name

    sfs-name-001

    The user-defined name of the general-purpose file system.

    This name must be globally unique and cannot be the same as the name of any existing general-purpose file system, including one created by the current user or any other user. And it cannot be changed after the file system is created.

    If a general-purpose file system is deleted, you can only create a general-purpose file system with the same name as the deleted one 30 minutes after that file system has been deleted.

    The name can be 3 to 63 characters long and can contain only lowercase letters, digits, hyphens (-), and periods (.). It cannot start or end with a period (.) or hyphen (-), cannot contain IP addresses, and cannot contain two consecutive periods (..) or a period (.) and a hyphen (-) adjacent to each other.

    Authorization

    By VPC

    You can select By VPC or By replication.

    By VPC: Select the VPC where the ECSs and VPC endpoint reside. An ECS cannot access a file system in a different VPC. Select the VPC where your ECSs reside. You can add VPCs later on the file system details page.

    By replication: This option is available after you select to replicate settings from a source file system.

    VPC

    -

    If you select authorization by VPC, you need to manually select a VPC.

    Select the IAM project to which the target VPC belongs and then select the target VPC. For details about IAM projects, see Project Management.

    Select the VPC where the ECSs and VPC endpoint reside.

    An ECS cannot access a general-purpose file system in a different VPC. Select the VPC where your ECSs reside. You can add VPCs later on the file system details page.

  4. Click Create Now.
  5. Confirm the file system information and click Submit.
  6. Go back to the general-purpose file system list.

    If you can see the general-purpose file system in the list, it is created successfully. If not, the creation fails.

Step 2: Mounting the General-Purpose File System

After a general-purpose file system is created, you need to mount it to ECSs so that they can share the file system.

  1. Log in the ECS as user root. You can log in to an ECS using the console or a remote access tool (such as PuTTY).

  2. Install the NFS client.

    1. Check whether the NFS software package is installed in the system (CentOS is used in this example).
      rpm -qa|grep nfs
      If information similar to the following is displayed, the NFS software package has been installed and you can go resolve the domain name. If not, go install the package.
      libnfsidmap
      nfs-utils

    2. Install the package.
      sudo yum -y install nfs-utils

      The command requires that the ECS be connected to the Internet. Or, the installation will fail.

  3. Check whether the domain name of the general-purpose file system can be resolved.

    nslookup <domain-name-of-the-general-purpose-file-system>
    • Obtain the domain name of a general-purpose file system from its mount point. For example, if the mount point of a general-purpose file system is xxx:/sfs-name-001, xxx is the file system domain name, and sfs-name-001 is the file system name.
    • If the nslookup command cannot be used, you can run yum install bind-utils to install the bind-utils software package.

  4. Mount the NFS file system root directory.

    mkdir <local-path>
    mount -t nfs -o vers=3,timeo=600,noresvport,nolock,tcp <mount-point> <local-path>

    If any other resources, such as a disk, have been mounted on the desired local path, create a new path. (NFS clients do not refuse repeated mounts. If there are repeated mounts, information of the last successful mount is displayed.)

    Parameter

    Description

    vers

    Version of the general-purpose file system. Only NFSv3 is supported currently, so the value is fixed at 3.

    timeo

    Waiting time before the NFS client retransmits a request. The unit is 0.1 second. The recommended value is 600.

    noresvport

    Whether the NFS client uses a new TCP port when it re-establishes a network connection to the NFS server.

    It is strongly recommended that you specify noresvport, which ensures that your file system remains uninterrupted after a network reconnection or recovery.

    nolock

    Whether to use the NLM protocol to lock files on the server. If nolock is specified, the lock is valid only for applications on the same client. It is invalid for applications on any other clients.

    tcp

    Protocol used by the NFS client to send requests to the server. You can use either UDP or TCP.

    General-Purpose File System does not support UDP. Therefore, you need to set proto to tcp for general-purpose file systems.

    <mount-point>

    The format is <file-system-domain-name>:/<file-system-name>, for example, example.com:/sfs-name-001.

    <local-path>

    A local path on the ECS used to mount the general-purpose file system, for example, /local_path.

  5. View the mounted general-purpose file system.

    mount -l
    If the command output contains the following information, the file system has been mounted:
    <mount-point> on </local-path> type nfs (rw,vers=3,timeo=600,nolock,addr=)

  6. (Optional) Modify the fstab file to configure file system auto mount upon system startup.

    After a client ECS is restarted, it loses the file system mount information. You can configure auto mount in the fstab file to ensure that the ECS automatically mounts the file system when it restarts.

    1. Open the /etc/fstab file.
    vi /etc/fstab
    At the end of the file, add information about the general-purpose file system, for example:
    <mount-point> </local-path> nfs vers=3,timeo=600,noresvport,nolock,tcp 0 0

    Replace <mount-point> and </local-path> with actual values. You can obtain the mount point from the Mount Point column of the file system. The fields are described as follows.

    Parameter

    Description

    <mount-point>

    The address or location of the general-purpose file system. Set it to the mount point used in the mount command when mounting the file system root directory.

    /local_path

    A directory created on the ECS for mounting the general-purpose file system. Set it to the local path used in the mount command when mounting the file system root directory.

    nfs

    The file system or partition mount type.

    vers=3,timeo=600,noresvport,nolock,tcp

    Use commas (,) to separate multiple options.

    • vers: The general-purpose file system version. Value 3 indicates NFSv3.
    • timeo: The waiting time before the NFS client retransmits a request. The unit is 0.1 second. The recommended value is 600.
    • noresvport: Whether the NFS client uses a new TCP port when it re-establishes a network connection to the NFS server. It is strongly recommended that you specify noresvport, which ensures that your file system remains uninterrupted after a network reconnection or recovery.
    • nolock: Whether to use the NLM protocol to lock files on the server. If nolock is specified, the lock is valid only for applications on the same client. It is invalid for applications on any other clients.
    • tcp: The TCP transmission protocol.

    0

    • An integer greater than zero means that dump backup is used. A general-purpose file system with a smaller integer is dumped earlier than one with a larger integer.
    • 0 means not to back up the general-purpose file system.

    0

    • This field is set to 1 for the root directory by default. The values for other directories start from 2. A general-purpose file system with a smaller integer is checked earlier than one with a larger integer.
    • 0 means not to check the general-purpose file system.

    For optimal system performance, configure file system information based on the mount example provided. If needed, you can customize certain mount options. Note that the customization may affect system performance.

    1. Press Esc, enter :wq, and press Enter to save and exit.
    1. (Optional) View the content of the /etc/fstab file after the update.
    cat /etc/fstab

For the detailed mount procedure, see Mounting a General-Purpose File System to Linux ECSs.

Step 3: Using the General-Purpose File System

After the file system is mounted, you can use it on the ECS as if using an ordinary directory, for example, read data from or write data to the file system.

  1. Remotely connect to the ECS and run the following commands to write data to the general-purpose file system:

    # /mnt/sfs is the local mount point (local path).
    mkdir /mnt/sfs/dir1
    touch /mnt/sfs/file1
    echo 'hello sfs' > /mnt/sfs/file2

  2. Remotely connect to the ECS and run the following commands to read data from the general-purpose file system:

    ls /mnt/sfs

    If information similar to the following is displayed, the general-purpose file system can be accessed using NFS.

Related Information

After creating and mounting a general-purpose file system, you can use the following functions as needed:

  • Configuring a Lifecycle Rule: To reduce storage costs, you can configure lifecycle rules to convert data in the general-purpose file system to infrequent access storage after a certain period.