Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Scalable File Service/ Getting Started/ Mount a File System/ Mounting a File System Automatically

Mounting a File System Automatically

Updated on 2024-07-19 GMT+08:00

File system mounting information may be lost after a server is restarted. You can configure auto mount on the server to avoid losing the mounting information.

Restrictions

Because the service startup sequences in different OSs vary, some servers running CentOS may not support the following auto mount plans. In this case, manually mount the file system.

Procedure (Linux)

  1. Log in to the ECS as user root.
  2. Run the vi /etc/fstab command to edit the /etc/fstab file.

    At the end of the file, add the file system information, for example:
    Mount point /local_path nfs vers=3,timeo=600,nolock 0 0

    Replace Mount point and /local_path with actual values. You can obtain the mount point from the Mount Address column of the file system. Each record in the /etc/fstab file corresponds to a mount. Each record has six fields, as described in Field Description.

    NOTICE:

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

  3. Press Esc, enter :wq, and press Enter to save and exit.

    After the preceding configurations are complete, the system reads the mount information from the /etc/fstab file to automatically mount the file system when the ECS restarts.

  4. (Optional) View the updated content of the /etc/fstab file.

    cat /etc/fstab

    Figure 1 shows the updated file content.

    Figure 1 Updated file content

  5. If auto mount fails due to a network issue, add the sleep option and a time in front of the mount command in the rc.local file, and mount the file system after the NFS service is started.

    sleep 10s && sudo mount -t nfs -o vers=3,timeo=600,noresvport,nolock,tcp Mount point/local_path

Field Description

Table 1 describes the mount fields.

Table 1 Field description

Field

Description

Mount point

The mount point of the file system to be mounted. Set this parameter to the mount point in the mount command in Mounting an NFS File System to ECSs (Linux).

/local_path

The directory where the file system is mounted on in the ECS. Set this parameter to the local path in the mount command in Mounting an NFS File System to ECSs (Linux).

nfs

The file system or partition mount type. Set it to nfs.

vers=3,timeo=600,nolock

Mount options. Use commas (,) to separate multiple options.

  • vers: The file system version. Value 3 indicates the NFSv3 protocol.
  • timeo: The waiting time before the NFS client retransmits a request. The unit is 0.1 second. The recommended value is 600.
  • nolock: specifies whether to lock files on the server using the NLM protocol.

0

Choose whether to back up file systems using the dump command.

  • 0: Backup is not used.
  • An integer larger than 0 means that the file system is backed up. A smaller value has a higher check priority.

0

Choose whether to check file systems using the fsck program when the ECS starts and specify the sequence for checking file systems.

  • 0: File systems are not checked.
  • By default, this field is set to 1 for the root directory. The values for other directories start from 2, and one with a smaller integer is checked earlier than that with a larger integer.

Procedure (Windows)

Ensure that an NFS client has been installed on the target server before mounting. This section uses Windows Server 2012 as an example to describe how to mount a file system.

  1. Log in to ECS.
  2. Before mounting the file system, create a script named auto_mount.bat, save the script to a local host, and record the save path. The script contains the following content:

    mount -o nolock mount point corresponding drive letter
    Figure 2 Saving the script

    For example, the auto_mount.bat script of a file system contains the following content:

    For SFS Capacity-Oriented file systems: mount -o nolock mount point X:

    NOTE:
    • You can copy the mount command of the file system from the console.
    • After the script is created, manually run the script in the Command Prompt to ensure that the script can be executed successfully. If you can view the file system in This PC after the script execution, the script can be executed properly.
    • This .bat script cannot be stored in the same path in 3 that stores the .vbs file. In this example, the .bat script is stored in C:\test\.

  3. Create a .txt file whose name is XXX.vbs and save the file to the directory C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup. The file contains the following content:

    set ws=WScript.CreateObject("WScript.Shell") 
    ws.Run "Local path and script name of the auto_mount.bat script /start", 0
    Figure 3 Creating .vbs file
    NOTE:

    In this example, the local path of the auto_mount.bat script is C:\test\. Therefore, the content in the .vbs file is as follows:

    set ws=WScript.CreateObject("WScript.Shell") 
    ws.Run "C:\test\auto_mount.bat /start",0

  4. After the task is created, you can restart the ECS and check whether the configuration is successful. After the configuration is successful, the file system automatically appears in This PC.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback