Mounting and Using an SFS Turbo File System on Linux ECSs
Scenarios
To use an SFS Turbo file system for file sharing, you need to create an SFS Turbo file system and mount it on multiple cloud servers.
This section describes how to create an NFS file system on the SFS Turbo console and mount it to Linux ECSs for file upload and download.
Operation Process
Procedure |
Description |
---|---|
Sign up for a HUAWEI ID, complete real-name authentication, enable Huawei Cloud services, and top up your account. Then, create a VPC and ECSs. |
|
Create an SFS Turbo file system. |
|
Mount the SFS Turbo file system to the ECSs. |
|
Use the SFS Turbo file system for file upload and download. |
Preparations
- Sign up for Huawei Cloud and complete real-name authentication.
Before purchasing SFS Turbo, 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.
- Top up your account.
Ensure that your account has sufficient balance or has a valid payment method configured. For details, see Topping Up an Account.
- Check whether a VPC and ECSs need to be created.
Before creating an SFS Turbo 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 Turbo and ECSs using VPC peering connections. For details, see VPC Peering Connection.
- Create a VPC.
Create a VPC by referring to Creating a VPC in the Virtual Private Cloud User Guide.
- Create ECSs.
Buy ECSs in CN-Hong Kong in the created VPC by referring to Purchasing and Using a Linux ECS.
Step 1: Creating an SFS Turbo File System
File systems are containers that store files in SFS Turbo. You need to create an SFS Turbo file system before storing data in it.
This example covers only some key parameters settings. Retain the default values for other parameters. For more information, see Creating an SFS Turbo File System.
- Log in to SFS Turbo console.
- Select the region where the ECSs are deployed. A file system can only be mounted to an ECS when they are in the same region and VPC. Select the CN-Hong Kong region.
- Click Create File System.
- Configure the file system parameters, which are described in the following table.
Parameter
Example Value
Description
Billing Mode
Pay-per-use
Select a billing mode, Yearly/Monthly or Pay-per-use. For the detailed billing standards, see Product Pricing Details.
Region
CN-Hong Kong
Region of the user.
Select the region where the ECSs 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.
Type
125 MB/s/TiB
Select 125 MB/s/TiB. After an SFS Turbo file system is created, its type cannot be changed. If you want to change the type, you need to create another file system. Plan the file system type in advance.
For more information, see File System Types.
Capacity (TB)
1.2
Maximum capacity of the current SFS Turbo file system.
When the used capacity of the file system reaches this value, no more data can be written to the file system. You need to expand the file system capacity. The capacity of an SFS Turbo file system cannot be reduced. Set an appropriate file system capacity based on your service needs.
Supported capacity range for a 125 MB/s/TiB SFS Turbo file systems: 1.2 TB to 1 PB
Enterprise Project
default
This parameter shows up only when you use an enterprise account to create an SFS Turbo file system.
You can manage file systems by project.
VPC
VPC: vpc-default
Subnet: subnet-default (192.168.0.0/24)
Select the VPC where the ECSs reside and select a subnet (CIDR block).
To obtain the required information, log in to the ECS console and click the ECS name to go to its summary page. Click the VPC name to the right of the VPC field to open the VPC list and obtain the VPC and subnet information.
Name
sfs-turbo-b6a6
User-defined name of the SFS Turbo file system.
The name can contain only letters, digits, underscores (_), and hyphens (-). It must start with a letter and can contain 4 to 64 characters.
- Click Create Now.
- Confirm the file system information and click Submit.
- When the creation is complete, go back to the SFS Turbo file system list. If the status of the created file system is Available, the file system has been created. If the status is Creation failed, handle the failure by referring to see Creating an SFS Turbo File System Failed.
- In the SFS Turbo file system list, take note of the shared path. It is required when the file system is mounted.
Step 2: Mounting the SFS Turbo File System
After an SFS Turbo file system is created, you need to mount it to ECSs so that they can share the file system.
- Log in to the ECS as user root. You can log in to an ECS using the console or a remote access tool (such as PuTTY).
- Install the NFS client.
- Install the NFS client.
- 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 to resolve the domain name. If not, run the installation command.libnfsidmap nfs-utils
- Install the client.
sudo yum -y install nfs-utils
The commands require that the ECSs be connected to the Internet. Or, the installation will fail.
- Check whether the NFS software package is installed in the system (CentOS is used in this example).
- Install the NFS client.
- Check whether the domain name in the file system shared path can be resolved.
nslookup <File system domain name>
- The file system domain name is in the format of xxx.sfsturbo.internal (variable xxx is the file system ID). You can obtain the domain name from the file system shared path.
- If the nslookup command cannot be used, you can run yum install bind-utils to install the bind-utils software package.
- If the domain name can be resolved, mount the NFS file system root directory.
- If the domain name cannot be resolved, configure the DNS server IP address before mounting the file system. For details, see Configuring a DNS Server for Domain Name Resolution.
- Mount the NFS file system root directory.
mkdir <Local path> mount -t nfs -o vers=3,timeo=600,noresvport,nolock,tcp <Shared path> <Local path>
If any other resources, such as a disk, have been mounted on the 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 SFS Turbo file system. Only NFSv3 is supported currently, so the value is fixed to 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 host. It is invalid for applications on any other hosts.
tcp
Protocol used by NFS clients to send requests to the server. You can use either UDP or TCP.
<Shared path>
The type of the SFS Turbo file system is 125 MB/s/TiB, and its shared path is xxx.sfsturbo.internal:/. Variable xxx is the file system ID.
<Local path>
A local path on the ECS used to mount the SFS Turbo file system. For example, /local_path.
- View the mounted SFS Turbo file system.
mount -l
If the command output contains the following information, the file system has been mounted:<Shared path> on </local_path> type nfs (rw,vers=3,timeo=600,nolock,addr=)
- (Optional) Configure 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.
- Open the /etc/fstab file.
vi /etc/fsta
At the end of the file, add the SFS Turbo file system information, for example:<Shared path> </local_path> nfs vers=3,timeo=600,noresvport,nolock,tcp 0 0
Replace <Shared path> and </local_path> with actual values. You can obtain the shared path from the Shared Path column of the file system. Other fields are described as follows.
Parameter
Description
<Shared path>
The mount address of the SFS Turbo file system. It is used when the file system root directory is mounted.
</local_path>
A directory created on the ECS for mounting the SFS Turbo file system. Set it to the local path in the mount command used when the file system root directory is mounted.
nfs
The file system or partition mount type.
vers=3,timeo=600,noresvport,nolock,tcp
Use commas (,) to separate multiple options.
- vers: The SFS Turbo 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 host. It is invalid for applications on any other hosts.
- tcp: The TCP transmission protocol.
0
- An integer greater than 0 means to back up the SFS Turbo file system. A smaller value has a higher backup priority.
- 0 means not to back up the SFS Turbo file system.
0
- This field is set to 1 for the root directory by default. The values for other directories start from 2, and one with a smaller integer is checked earlier than one with a larger integer.
- 0 means not to check the SFS Turbo file system.
For optimal system performance, configure file system information based on the mount example provided. If needed, you can customize certain mount options. However, the customization may affect system performance.
- Press Esc, enter :wq, and press Enter to save and exit.
- (Optional) View the updated content of the /etc/fstab file.
cat /etc/fstab
Figure 1 Updated file content
For the detailed mount procedure, see Mounting an NFS File System to Linux ECSs as Root.
Step 3: Using the SFS Turbo 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.
- Remotely connect to the ECS and run the following commands to write data to the SFS Turbo 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
- Remotely connect to the ECS and run the following command to read data from the SFS Turbo file system:
ls /mnt/sfs
If information similar to the following is displayed, the SFS Turbo file system can be accessed using NFS.
Helpful Links
After creating and mounting an SFS Turbo file system, you can use the following functions as needed:
- Backup: You can back up SFS Turbo file systems using CBR. If your file system becomes faulty or encounters a logical error (like accidental deletion, hacker attack, and virus), you can use their backups to quickly restore data.
- Capacity expansion: If your file system capacity is insufficient, you can increase the file system size by expanding capacity.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot