Scalable File Service

Mounting a File System Automatically after Startup (Linux)

2024-09-11 06:42:40

Application Scenarios

Mounting information may be lost after the cloud server mounted with the file system is restarted. To avoid this issue, you can configure automatic mounting during restart on the cloud server.

Making Preparations

You have an ECS and has mounted the file system. For specific steps, see Mounting an NFS File System to ECSs (Linux).

Procedure

1.       Log in to the cloud server as root user. For details, see Logging into a Linux ECS - ECS - Quick Start.

2.       Run "vi /etc/rc.d/rc.local" to edit the rc.local file and add mount information at the end of the file . You can obtain the mount address on the file system details page. When the configuration is complete, click Esc, and enter :wq. Then, save the file and exit. Here is a configuration example:

sleep 10s && sudo mount -t nfs -o vers=3,async,nolock,noatime,nodiratime,proto=tcp,wsize=1048576,rsize=1048576,timeo=600 Mount address: Local path

3.       Run "chmod +x /etc/rc.d/rc.local”.

4.       After the above configuration is completed, when the cloud server restarts, the system waits for 10s and then automatically mounts the file system.


2CR4IcogDBMM