File system mounting information may be lost after a server is restarted. You can configure automatic mounting for the server to avoid the mounting information loss.
Because the service startup sequences in different operating systems vary, some servers running CentOS may not support the following automatic mounting schemes. In this case, manually mount the file system.
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.
For 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.
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.
cat /etc/fstab
Figure 1 shows the updated file content.
sleep 10s && sudo mount -t nfs -o vers=3,timeo=600,noresvport,nolock Mount point/local_path
Table 1 describes the mount fields.
Field |
Description |
---|---|
Mount point |
Mount object, that is, the mount point of the file system to be mounted. Set this parameter to the mount point in the mount command that is used in Mounting an NFS File System to ECSs (Linux). |
/local_path |
Mount point, that is, the directory created on the ECS for mounting the file system. Set this parameter to the local path in the mount command that is used in Mounting an NFS File System to ECSs (Linux). |
nfs |
Mount type, that is, file system or partition type. Set it to nfs. |
vers=3,timeo=600,nolock |
Mount options, used to set mount parameters. Use commas (,) to separate between multiple options.
|
0 |
Choose whether to back up file systems using the dump command.
|
0 |
Choose whether to check file systems using the fsck command when the ECS is starting and specify the sequence for checking file systems.
|
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.
mount -o nolock mount point corresponding drive letter
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:
For SFS Turbo file systems: mount -o nolock -o casesensitive=yes IP address:/! X:
set ws=WScript.CreateObject("WScript.Shell") ws.Run "Local path and script name of the auto_mount.bat script /start", 0
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