Updated on 2022-09-16 GMT+08:00

Creating a Local Directory for a File System

After creating a file system, you need to mount the file system to an ECS and create a local directory for the root user.

If the file system has been mounted, skip this section. Record the local directory in 3 and perform steps in Creating a Readable and Writable Subdirectory on the File System for Each User.

Prerequisites

  • You have checked the type of the ECS operating system. Different operating systems require different commands for NFS client installation.
  • You have created a file system and have obtained the mount point of the file system.
  • The ECS to which a file system is mounted belongs to the same VPC as the file system.
  • The IP addresses of the DNS server used to resolve the file system domain name have been configured on the ECS.

Procedure

  1. An ECS running CentOS is created in AZ2 of the CN North-Beijing1 region.
  2. Log in to the ECS as user root. Install the NFS client.

    1. Run the following command to check whether the NFS software package is installed.
      • On CentOS, Red Hat, Oracle Enterprise Linux, SUSE, Euler OS, Fedora, or OpenSUSE:

        rpm -qa|grep nfs

      • On Debian or Ubuntu:

        dpkg -l nfs-common

      If a command output similar to the following is displayed, the NFS software package has been installed and you can go to Step 3. If nothing is displayed, go to Step 2.2.
      • On CentOS, Red Hat, Euler OS, Fedora, or Oracle Enterprise Linux:
        libnfsidmap
        nfs-utils
      • On SUSE or OpenSUSE:
        nfsidmap
        nfs-client
      • On Debian or Ubuntu:
        nfs-common
    2. Run the following command to install the NFS software package.

      The following commands require that the ECS be connected to the Internet. Otherwise, the installation will fail.

      • On CentOS, Red Hat, Euler OS, Fedora, or Oracle Enterprise Linux:

        sudo yum -y install nfs-utils

      • On Debian or Ubuntu:

        sudo apt-get install nfs-common

      • On SUSE or OpenSUSE:

        zypper install nfs-client

  3. Run the following command to create a local directory for mounting the file system. Record the local directory name, for example, root001.

    mkdir Local directory

    mkdir root001

  4. Run the following command to mount the file system to the ECS. SFS supports mounting only file systems complying with NFSv3 to ECSs running Linux. Table 1 describes the variables.

    mount -t nfs -o vers=3,timeo=600,nolock Mount point Local directory

    After an ECS that has mounted file systems restarts, it loses the file system mount information. You can configure automatic mount in the fstab file to ensure that an ECS automatically mounts file systems when it restarts. For details, see "Mounting a File System Automatically" in the Scalable File Service User Guide.

    Table 1 Parameters

    Parameter

    Description

    vers

    File system version. Currently, only NFSv3 is supported, so the value is fixed to 3.

    timeo

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

    lock/nolock

    Whether to lock files on the server using the NLM protocol. If nolock is selected, the lock is valid for applications on one host. For applications on another host, the lock is invalid. Recommended value: nolock

    Mount point

    The format for an SFS file system is File system domain name:/Path, for example, example.com:/share-xxx. The format for an SFS Turbo file system is File system IP address:/, for example, 192.168.0.0:/.

    NOTE:

    x can be a digit or letter.

    If the mount point is too long to display completely, expand the column to view the full mount point.

    Local directory

    Local directory on the ECS, used to mount the file system, for example, /local_path.

  5. Run the following command to view the mounted file system:

    mount -l

    If the command output contains the following information, the file system is mounted successfully.
    IP on /local_path type nfs (rw,vers=3,timeo=600,nolock,addr=)

  6. After the mounting is successful, create a common user and subdirectory by referring to the next section.

    If the mounting fails or times out, rectify the fault. For details, see "Troubleshooting" in the Scalable File Service User Guide.

    The supported maximum size of a file to be written is 240 TB.