Mounting a File System Automatically
File system mount information may be lost after a server is restarted. You can configure auto mount on the server to avoid losing the mount information.
Restrictions
Because 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)
- Log in to the server as user root.
- 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:
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. Each record in the /etc/fstab file corresponds to a mount. Each record has six fields, as described in Mount Fields.
For optimal system performance, configure file system information based on the previous example. 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.
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 server restarts.
- (Optional) View the updated content of the /etc/fstab file.
cat /etc/fstab
Figure 1 shows the updated file content.
- 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 Shared path/local_path
Mount Fields
Table 1 describes the mount fields.
Field |
Description |
---|---|
Shared path |
The address of the file system to be mounted. Set it to the shared path in the mount command in Mounting an NFS File System to ECSs (Linux). |
/local_path |
The directory created on the server for mounting the file system. Set it 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,noresvport,nolock,tcp |
Mount options. Use commas (,) to separate multiple options.
|
0 |
Choose whether to use dump to back up the file system.
|
0 |
Choose whether to use fsck to check the file system when the server starts and specify the check sequence.
|
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