• Scalable File Service

  1. Help Center
  2. Scalable File Service
  3. User Guide
  4. Related Resources
  5. Mounting a File System Automatically

Mounting a File System Automatically

To prevent mounting information loss after a restart of the ECS where a file system is mounted, you can configure the ECS and make the file system automatically be mounted after the ECS restarts.


Due to different mechanisms for managing startup items (service startup sequence), some CentOS ECSs may not support the following automatic mounting schemes: 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:
    example.com:/share-xxx /local_path nfs vers=3,timeo=600,nolock 0 0

    Replace example.com:/share-xxx and /local_path with actual values. Each record in the /etc/fstab file corresponds to a mount. Each record has six fields, as described in Field Description.

    For an optimal system performance, configure file system information based on the previous example configuration. If needed, you can customize part of mount parameters. However, the customization may affect system performance.

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

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

  4. (Optional) Run the following command to view the updated content of the /etc/fstab file.

    cat /etc/fstab

    Figure 1 shows the updated file content.

    Figure 1 Updated file content

Field Description

Table 1 describes the mount fields.

Table 1 Field description




Mount object, that is, the shared path of the file system to be mounted. Set it to the shared path in the mount command described in Mounting an NFS File System to ECSs (Linux).


Mount point, that is, the directory created on the ECS for mounting the file system. Set it to the local path in the mount command described in Mounting an NFS File System to ECSs (Linux).


Mount type, that is, file system or partition type. Set it to nfs.


Mount options, used to set mount parameters. Use commas (,) to separate between multiple options.

  • vers: File system version. The 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.
  • nolock: Whether to lock files on the server using the NLM protocol.


Choose whether to back up file systems using dump.

  • 0: not to back up
  • An integer larger than 0: to back up file systems. A file system with a smaller integer is checked earlier than that with a larger integer.


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

  • 0: to check
  • Set this field to 1 for the root directory partition. Other partitions start from 2, and a partition 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. 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 Shared path Corresponding drive letter

    For example, content of a file system's auto_mount.bat script can be mount -o nolock sfs.nas1.xxx.com/share-xxx X:


    After the script is created, you are advised to manually run the script in the CMD interface to ensure that the script can be executed successfully.

  2. Create a .txt file whose name is XXX.vbs and Save Type is All Files, 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 of the auto_mount.bat script /start", 0

  3. After the task is created, you can restart the ECS and check whether the configuration is successful.