Updated on 2025-08-19 GMT+08:00

Disk Mounting

This section describes how to mount a disk to a function on the FunctionGraph console to expand the storage space of the function.

Scenarios

FunctionGraph supports persistent storage by mounting file systems. Advantages:

  • Multiple functions can mount and share the same file system.
  • Existing storage capabilities of ECSs can be used to dynamically expand compute resources.
  • Compared with the temporary storage space /tmp, the function storage space can be greatly expanded.

The /tmp directory can store temporary files. The default size is 512 MB and the maximum size is 10,240 MB.

FunctionGraph supports the following file systems:

  • SFS Turbo

    SFS Turbo provides a fully hosted shared file storage that can provide petabytes of capacity, sub-millisecond latency, up to tens of millions of IOPS, and hundreds of GB/s of bandwidth. It can provide high availability and durability for workloads dealing with massive small files and applications that require low latency and high IOPS. For details about the regions where SFS is available, see SFS Function Overview.

  • SFS General-purpose

    Expandable to petabytes of capacity and terabytes of bandwidth, the general purpose file system provides fully hosted shared file storage. It features high availability and durability, and provides supports for data-intensive and bandwidth-intensive applications. For details about the regions where SFS is available, see SFS Function Overview.

  • ECS

    A directory on an ECS is specified as a shared file system by using the network file system (NFS) service. Functions can mount the directory for read and write operations. You can configure user permissions to manage shared data resources. It is suitable for lightweight data processing and infrequent file sharing.

  • SFS Capacity-Oriented (available only for existing users)

    Expandable to petabytes, SFS Capacity-Oriented file systems provide fully hosted shared file storage. It features high availability and durability, and provides support for data-intensive and bandwidth-intensive applications. For details, see the SFS Service Overview.

Notes and Constraints

  • Only existing users can mount SFS Capacity-Oriented file systems. The regions where each file system can be mounted are subject to the console.
  • Do not read or write data on disks in the initializer. Otherwise, the function cannot read data on disks.
  • The following file system ports must be enabled: 111, 445, 2049, 2051, 2052, and 20048.
    Another three ports for Ubuntu. To obtain the port numbers, run the following command:
    rpcinfo -p|grep mountd|grep tcp

    For details, see What Resources Does SFS Occupy?

Prerequisites

Table 1 Prerequisites for mounting a disk

File System Source

Prerequisites

Mounting an SFS Turbo file system

  • You have created an SFS Turbo file system to be mounted. For details, see Creating a File System.

    You have recorded the VPC and subnet information used by the SFS Turbo file system.

  • You have created the agency required for mounting an SFS Turbo file system. For details, see Configuring Agency Permissions.

Mounting a General Purpose File System

  • You have created an SFS General-purpose system to be mounted. For details, see Creating a File System.

    You have recorded the VPC and subnet information used by the SFS General-purpose file system.

  • You have created the agency required for mounting an SFS General-purpose file system. For details, see Configuring Agency Permissions.

Mounting an ECS shared directory

Mounting an SFS Capacity-Oriented File System (for Existing Users Only)

Mounting an SFS Turbo file system

  1. Log in to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
  2. Click the name of a function.
  3. Choose Configuration > Permissions to configure an agency for the function to access the SFS Turbo file system.
    1. Select the agency created in Prerequisites.
    2. Click Save.
  4. Choose Configuration > Network to configure the VPC for the function to access the SFS Turbo file system.
    1. Enable VPC Access.
    2. Set VPC and Subnet to the VPC and subnet recorded in Prerequisites.
    3. Click Save.
  5. Choose Configuration > File Systems.
  6. Click Mount File System. In the displayed dialog box, configure the SFS Turbo file system.
    Table 2 Parameters for mounting an SFS Turbo file system

    Parameter

    Description

    Example Value

    User ID

    User ID to be used for the function to access the specified file system. The value can be –1 (default) or an integer ranging from 1 to 65534, excluding 1000 and 1002. –1 indicates that the system automatically allocates the user ID.

    For SFS Turbo file systems, retain the default value –1.

    -1

    Group ID

    Group ID to be used for the function to access the specified file system. The value can be –1 (default) or an integer ranging from 1 to 65534, excluding 1000 and 1002. –1 indicates that the system automatically allocates the group ID.

    For SFS Turbo file systems, retain the default value –1.

    -1

    File System Type

    Select the type of the file system to be mounted. In this example, select SFS Turbo.

    SFS Turbo

    File System

    Select the name of the SFS Turbo file system to be mounted.

    sfs-turbo-fg

    Shared Directory

    Specify the shared directory of the file system. The path must start with a slash (/), for example, /a.

    If this parameter is not set, the function can access all directories of the file system. If a specific directory path is configured, the function can access only the directory path.

    /a

    Access Path

    Specify the directory path used by the function to access files in the file system. The path must start with a slash (/) and contain a maximum of two levels. You are advised to set this parameter to a level-2 directory starting with /mnt or /home.

    The directory that already exists in the system cannot be used. Otherwise, the error message failed to mount exist system path is displayed.

    For example, the shared directory path is /a, with files /a/b and /a/c/d under it. If the function access path is /mnt/test, then the paths for the function to access file b and file d are /mnt/test/b and /mnt/test/c/d respectively.

    /mnt/test

  7. Click OK.

Mounting a General Purpose File System

  1. Log in to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
  2. Click the name of a function.
  3. Choose Configuration > Permissions to configure an agency for the function to access the SFS General-purpose file system.
    1. Select the agency created in Prerequisites.
    2. Click Save.
  4. Choose Configuration > Network to configure the VPC for the function to access the SFS General-purpose file system.
    1. Enable VPC Access.
    2. Set VPC and Subnet to the VPC and subnet recorded in Prerequisites.
    3. Click Save.
  5. Choose Configuration > File Systems.
  6. Click Mount File System. In the displayed dialog box, configure the SFS General-purpose file system.
    Table 3 Parameters for mounting an SFS General-purpose file system

    Parameter

    Description

    Example Value

    User ID

    User ID to be used for the function to access the specified file system. The value can be –1 (default) or an integer ranging from 1 to 65534, excluding 1000 and 1002. –1 indicates that the system automatically allocates the user ID.

    For SFS Turbo file systems, retain the default value –1.

    -1

    Group ID

    Group ID to be used for the function to access the specified file system. The value can be –1 (default) or an integer ranging from 1 to 65534, excluding 1000 and 1002. –1 indicates that the system automatically allocates the group ID.

    For SFS Turbo file systems, retain the default value –1.

    -1

    File System Type

    Select the type of the file system to be mounted. In this example, select General purpose.

    General purpose

    File System

    Select the name of the SFS General-purpose file system to be mounted.

    sfs-fg

    Access Path

    Specify the directory path used by the function to access files in the file system. The path must start with a slash (/) and contain a maximum of two levels. You are advised to set this parameter to a level-2 directory starting with /mnt or /home.

    The directory that already exists in the system cannot be used. Otherwise, the error message failed to mount exist system path is displayed.

    For example, the shared directory path is /a, with files /a/b and /a/c/d under it. If the function access path is /mnt/test, then the paths for the function to access file b and file d are /mnt/test/b and /mnt/test/c/d respectively.

    /mnt/test

  7. Click OK.

Mounting an ECS Shared Directory

  1. Log in to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
  2. Click the name of a function.
  3. Choose Configuration > Permissions to configure the agency for the function to access the ECS shared directory.
    1. Select the agency created in Prerequisites.
    2. Click Save.
  4. Choose Configuration > Network to configure the VPC for the function to access the ECS shared directory.
    1. Enable VPC Access.
    2. Set VPC and Subnet to the VPC and subnet recorded in Prerequisites.
    3. Click Save.
  5. Choose Configuration > File Systems.
  6. Click Mount File System. In the displayed dialog box, configure the ECS shared directory.
    Table 4 Parameters for mounting an ECS shared directory

    Parameter

    Description

    Example Value

    User ID

    User ID to be used for the function to access the specified file system. The value can be –1 (default) or an integer ranging from 1 to 65534, excluding 1000 and 1002. –1 indicates that the system automatically allocates the user ID.

    • For ECSs on Windows, retain the default value –1.
    • For ECSs on Linux, use the system uid. For example, if the Linux username is test-user, you can run the id test-user command to query the uid and gid.

    -1

    Group ID

    Group ID to be used for the function to access the specified file system. The value can be –1 (default) or an integer ranging from 1 to 65534, excluding 1000 and 1002. –1 indicates that the system automatically allocates the group ID.

    • For ECSs on Windows, retain the default value –1.
    • For ECSs on Linux, use the system gid. For example, if the Linux username is test-user, you can run the id test-user command to query the gid.

    -1

    File System Type

    Select the file system type to be mounted. In this example, select ECS, which indicates the ECS shared directory.

    ECS

    ECS

    Select the name of the ECS to be mounted.

    ecs-fg

    Shared Directory

    Enter an existing directory path starting with a slash (/), for example, /a.

    If this parameter is not set, the function can access all directories in the file system.

    /a

    Access Path

    Specify the directory path used by the function to access files in the file system. The path must start with a slash (/) and contain a maximum of two levels. You are advised to set this parameter to a level-2 directory starting with /mnt or /home.

    The directory that already exists in the system cannot be used. Otherwise, the error message failed to mount exist system path is displayed.

    For example, the shared directory path is /a, with files /a/b and /a/c/d under it. If the function access path is /mnt/test, then the paths for the function to access file b and file d are /mnt/test/b and /mnt/test/c/d respectively.

    /mnt/test

  7. Click OK.

Creating an NFS Shared Directory on the ECS

Linux (CentOS, SUSE, EulerOS, Fedora, and OpenSUSE)

  • Procedure
    1. Configure a YUM repository.
      1. Create a file named euleros.repo in the /etc/yum.repos.d directory. Ensure that the file name end with .repo.
      2. Run the following command to edit the euleros.repo file.
        vi /etc/yum.repos.d/euleros.repo
      3. Add the information to the euleros.repo file.

        The EulerOS 2.0 SP3 YUM configuration is as follows:

        [base] 
        name=EulerOS-2.0SP3 base
        baseurl=http://repo.huaweicloud.com/euler/2.3/os/x86_64/
        enabled=1
        gpgcheck=1
        gpgkey=http://repo.huaweicloud.com/euler/2.3/os/RPM-GPG-KEY-EulerOS

        The EulerOS 2.0 SP5 YUM configuration is as follows:

        [base] 
        name=EulerOS-2.0SP5 base
        baseurl=http://repo.huaweicloud.com/euler/2.5/os/x86_64/
        enabled=1
        gpgcheck=1
        gpgkey=http://repo.huaweicloud.com/euler/2.5/os/RPM-GPG-KEY-EulerOS
        Table 5 Parameter description:

        Parameter

        Description

        name

        Repository name.

        baseurl

        Repository URL.

        • HTTP-based network address: http://path/to/repo
        • Local repository address: file:///path/to/local/repo

        gpgcheck

        Indicates whether to enable the GNU privacy guard (GPG) to check the validity and security of RPM package resources.

        • 1: The GPG check is enabled.
        • 0: The GPG check is disabled.
        • If this option is not specified, the GPG check is enabled by default.
      4. Press Esc to exit the input mode, enter :wq, and press Enter to save the euleros.repo file and exit.
      5. Run the following command to clear the cache.
        yum clean all
    2. Run the following command to install nfs-utils.
      yum install nfs-utils
    3. Set the shared directory.
      1. Run the following command to edit the /etc/exports file.
        vi /etc/exports
      2. Add the following information to the exports file.
        /sharedata  192.168.0.0/24(rw,sync,no_root_squash)

        /sharedata indicates the path of the directory to be shared. 192.168.0.0/24 indicates that the directory is shared to other servers in this CIDR block.

      3. Press Esc to exit the input mode, enter :wq, and press Enter to save the exports file and exit.
    4. Run the following commands to start the NFS service.
      systemctl start rpcbind
      service nfs start
    5. Run the following command to check whether the setting is successful.
      exportfs -v

      If the shared directory path is displayed in the command output, the setting is successful.

    6. Modify the shared directory.

      To modify or add a shared directory, modify the configuration file by referring to 3. After the modification, run the following command to restart the NFS service.

      service nfs restart
    7. (Optional) Enable automatic startup of the rpcbind service.

      Run the following command:

      systemctl enable rpcbind

Linux (Ubuntu)

  • Procedure
    1. Run the following commands to install nfs-kernel-server.
      sudo apt-get update
      sudo apt install nfs-kernel-server
    2. Set the shared directory.
      1. Run the following command to edit the /etc/exports file.
        vim /etc/exports
      2. Add the following information to the exports file.
        /sharedata  192.168.0.0/24(rw,sync,no_root_squash)

        /sharedata indicates the path of the directory to be shared. 192.168.0.0/24 indicates that the directory is shared to other servers in this CIDR block.

      3. Press Esc to exit the input mode, enter :wq, and press Enter to save the exports file and exit.
    3. Run the following commands to start the NFS service.
      service nfs-kernel-server restart
    4. Run the following command to check whether the setting is successful.
      exportfs -v

      If the shared directory path is displayed in the command output, the setting is successful.

    5. Modify the shared directory.

      To modify or add a shared directory, modify the configuration file by referring to 2. After the modification, run the following command to restart the NFS service.

      service nfs restart
    6. (Optional) Enable automatic startup of the rpcbind service.

      Run the following command:

      systemctl enable rpcbind