forked from docs/doc-exports
Reviewed-by: Muller, Martin <martin.muller@t-systems.com> Co-authored-by: zhangyue <zhangyue164@huawei.com> Co-committed-by: zhangyue <zhangyue164@huawei.com>
90 lines
16 KiB
HTML
90 lines
16 KiB
HTML
<a name="sfs_01_0025"></a><a name="sfs_01_0025"></a>
|
|
|
|
<h1 class="topictitle1">Mounting a File System Automatically</h1>
|
|
<div id="body1502855176563"><p id="sfs_01_0025__p10530934111010">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.</p>
|
|
<div class="section" id="sfs_01_0025__section133730912414"><h4 class="sectiontitle">Restrictions</h4><p id="sfs_01_0025__p54703111441">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.</p>
|
|
</div>
|
|
<div class="section" id="sfs_01_0025__section38954620214447"><h4 class="sectiontitle">Procedure (Linux)</h4><ol id="sfs_01_0025__ol31052151214457"><li id="sfs_01_0025__li54621311946"><span>Log in to the management console using a cloud account.</span><p><ol type="a" id="sfs_01_0025__ol1253112432049"><li id="sfs_01_0025__li194621111413">Log in to the management console and select a region and a project.</li><li id="sfs_01_0025__li1446216114413">Under <strong id="sfs_01_0025__b23022058143013">Computing</strong>, click <strong id="sfs_01_0025__b17307858123013">Elastic Cloud Server</strong> to switch to the ECS console.</li></ol>
|
|
</p></li><li id="sfs_01_0025__li21358386214457"><span>Log in to the ECS as user <strong id="sfs_01_0025__en-us_topic_0054116434_b84235270611308">root</strong>.</span></li><li id="sfs_01_0025__li40717767214526"><span>Run the <strong id="sfs_01_0025__b10997558110433">vi /etc/fstab</strong> command to edit the <strong id="sfs_01_0025__b84235270615915">/etc/fstab</strong> file.</span><p><div class="p" id="sfs_01_0025__p4652476311356">At the end of the file, add the file system information, for example:<pre class="screen" id="sfs_01_0025__screen25662203111850"><em id="sfs_01_0025__i148372111482">Mount point /local_path</em> nfs vers=3,timeo=600,nolock 0 0</pre>
|
|
</div>
|
|
<p id="sfs_01_0025__p37506451114016">Replace <em id="sfs_01_0025__i855927408111621">Mount point</em> and <em id="sfs_01_0025__i1313917117111625">/local_path</em> with actual values. You can obtain the mount point from the <strong id="sfs_01_0025__b689345616314">Mount Address</strong> column of the file system. Each record in the <strong id="sfs_01_0025__b842352706111648">/etc/fstab</strong> file corresponds to a mount. Each record has six fields, as described in <a href="#sfs_01_0025__section241009011643">Field Description</a>.</p>
|
|
<div class="notice" id="sfs_01_0025__note5180087211526"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><p id="sfs_01_0025__p6355466411526">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.</p>
|
|
</div></div>
|
|
</p></li><li id="sfs_01_0025__li33930135215718"><span>Press <strong id="sfs_01_0025__b51116037112652">Esc</strong>, input <strong id="sfs_01_0025__b58164000112657">:wq</strong>, and press <strong id="sfs_01_0025__b6357507311271">Enter</strong> to save and exit.</span><p><p id="sfs_01_0025__p5181592022449">After the preceding configurations are complete, the system reads mounting information from the <strong id="sfs_01_0025__b10680175154916">/etc/fstab</strong> file to automatically mount the file system when the ECS restarts.</p>
|
|
</p></li><li id="sfs_01_0025__li22181757215748"><span>(Optional) Run the following command to view the updated content of the <strong id="sfs_01_0025__b131626211310463">/etc/fstab</strong> file:</span><p><p id="sfs_01_0025__en-us_topic_0054116434_p346907151042"><strong id="sfs_01_0025__b45693947215832">cat /etc/fstab</strong></p>
|
|
<p id="sfs_01_0025__p4203030122844"><a href="#sfs_01_0025__fig1023252822220">Figure 1</a> shows the updated file content.</p>
|
|
<div class="fignone" id="sfs_01_0025__fig1023252822220"><a name="sfs_01_0025__fig1023252822220"></a><a name="fig1023252822220"></a><span class="figcap"><b>Figure 1 </b>Updated file content</span><br><span><img id="sfs_01_0025__image1863205519406" src="en-us_image_0000001567196485.png"></span></div>
|
|
</p></li><li id="sfs_01_0025__li63633710915"><span>If the automatic mounting fails due to a network issue, add the <strong id="sfs_01_0025__b436112162204">sleep</strong> parameter and a time in front of the mounting command in the <strong id="sfs_01_0025__b74099427205">rc.local</strong> file, and mount the file system after the NFS service is started.</span><p><pre class="screen" id="sfs_01_0025__screen47845481655"><strong id="sfs_01_0025__b198625422120">sleep 10s && sudo</strong> mount -t nfs -o vers=3,timeo=600,noresvport,nolock <em id="sfs_01_0025__i1985411385228">Mount point</em>/<em id="sfs_01_0025__i107423336226">local_path</em></pre>
|
|
</p></li></ol>
|
|
</div>
|
|
<div class="section" id="sfs_01_0025__section241009011643"><a name="sfs_01_0025__section241009011643"></a><a name="section241009011643"></a><h4 class="sectiontitle">Field Description</h4><p id="sfs_01_0025__p6058381214628"><a href="#sfs_01_0025__table215511301179">Table 1</a> describes the mount fields.</p>
|
|
|
|
<div class="tablenoborder"><a name="sfs_01_0025__table215511301179"></a><a name="table215511301179"></a><table cellpadding="4" cellspacing="0" summary="" id="sfs_01_0025__table215511301179" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Field description</caption><thead align="left"><tr id="sfs_01_0025__en-us_topic_0072155931_row1990488511206"><th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.4.3.2.3.1.1"><p id="sfs_01_0025__en-us_topic_0072155931_p168295211206">Field</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="80%" id="mcps1.3.4.3.2.3.1.2"><p id="sfs_01_0025__en-us_topic_0072155931_p210146111206">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="sfs_01_0025__en-us_topic_0072155931_row3037087111206"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.3.2.3.1.1 "><p id="sfs_01_0025__en-us_topic_0072155931_p4412150111206"><em id="sfs_01_0025__i2092314171365">Mount point</em></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="80%" headers="mcps1.3.4.3.2.3.1.2 "><p id="sfs_01_0025__en-us_topic_0072155931_p1707183511206">Mount object, that is, the mount point of the file system to be mounted. Set this parameter to the mount point in the <strong id="sfs_01_0025__b173934555816">mount</strong> command that is used in <a href="en-us_topic_0034428728.html">Mounting an NFS File System to ECSs (Linux)</a>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="sfs_01_0025__en-us_topic_0072155931_row3259701211206"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.3.2.3.1.1 "><p id="sfs_01_0025__en-us_topic_0072155931_p2311233111206"><em id="sfs_01_0025__i272352251490">/local_path</em></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="80%" headers="mcps1.3.4.3.2.3.1.2 "><p id="sfs_01_0025__en-us_topic_0072155931_p6015955111206">Mount point, that is, the directory created on the ECS for mounting the file system. Set this parameter to the local path in the <strong id="sfs_01_0025__b1463681911119">mount</strong> command that is used in <a href="en-us_topic_0034428728.html">Mounting an NFS File System to ECSs (Linux)</a>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="sfs_01_0025__en-us_topic_0072155931_row2074966211206"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.3.2.3.1.1 "><p id="sfs_01_0025__en-us_topic_0072155931_p300108911206">nfs</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="80%" headers="mcps1.3.4.3.2.3.1.2 "><p id="sfs_01_0025__en-us_topic_0072155931_p4176163611206">Mount type, that is, file system or partition type. Set it to <strong id="sfs_01_0025__b842352706112326">nfs</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="sfs_01_0025__en-us_topic_0072155931_row4391735511206"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.3.2.3.1.1 "><p id="sfs_01_0025__p34504224917">vers=3,timeo=600,nolock</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="80%" headers="mcps1.3.4.3.2.3.1.2 "><p id="sfs_01_0025__en-us_topic_0072155931_p4341916611206">Mount options, used to set mount parameters. Use commas (,) to separate between multiple options.</p>
|
|
<ul id="sfs_01_0025__ul53831621205"><li id="sfs_01_0025__li23835211305"><strong id="sfs_01_0025__b16314135920545">vers</strong>: file system version. The value <strong id="sfs_01_0025__b124841935181512">3</strong> indicates NFSv3.</li><li id="sfs_01_0025__li1238332115014"><strong id="sfs_01_0025__b14601161135512">timeo</strong>: waiting time before the NFS client retransmits a request. The unit is 0.1 second. The recommended value is <strong id="sfs_01_0025__b07071648185217">600</strong>.</li><li id="sfs_01_0025__li538302116012"><strong id="sfs_01_0025__b566543945511">nolock</strong>: specifies whether to lock files on the server using the NLM protocol.</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="sfs_01_0025__row6225105612613"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.3.2.3.1.1 "><p id="sfs_01_0025__p1422617561867">0</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="80%" headers="mcps1.3.4.3.2.3.1.2 "><p id="sfs_01_0025__p142261656967">Choose whether to back up file systems using the dump command.</p>
|
|
<ul id="sfs_01_0025__ul870812575717"><li id="sfs_01_0025__li27101357073"><strong id="sfs_01_0025__b84235270614443">0</strong>: not to back up file systems</li><li id="sfs_01_0025__li8210570812">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.</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="sfs_01_0025__row15551659469"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.3.2.3.1.1 "><p id="sfs_01_0025__p1255116591667">0</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="80%" headers="mcps1.3.4.3.2.3.1.2 "><p id="sfs_01_0025__p11551359261">Choose whether to check file systems using the fsck command when the ECS is starting and specify the sequence for checking file systems.</p>
|
|
<ul id="sfs_01_0025__ul747910315101"><li id="sfs_01_0025__li184797314104"><strong id="sfs_01_0025__b842352706144845">0</strong>: to check file systems</li><li id="sfs_01_0025__li167765137107">By default, this field is set to <strong id="sfs_01_0025__b842352706144957">1</strong> for the root directory partition. Other partitions start from <strong id="sfs_01_0025__b842352706145033">2</strong>, and a partition with a smaller integer is checked earlier than that with a larger integer.</li></ul>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="sfs_01_0025__section6323162217518"><h4 class="sectiontitle">Procedure (Windows)</h4><p id="sfs_01_0025__p2550830134315">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.</p>
|
|
<ol id="sfs_01_0025__ol19422114384212"><li id="sfs_01_0025__li151862291180"><span>Log in to the management console using a cloud account.</span><p><ol type="a" id="sfs_01_0025__ol17186629985"><li id="sfs_01_0025__li41861629885">Log in to the management console and select a region and a project.</li><li id="sfs_01_0025__li2186162917812">Under <strong id="sfs_01_0025__b147288147312">Computing</strong>, click <strong id="sfs_01_0025__b11733141420317">Elastic Cloud Server</strong> to switch to the ECS console.</li></ol>
|
|
</p></li><li id="sfs_01_0025__li1794418553818"><span>Log in to the ECS.</span></li><li id="sfs_01_0025__li1042224313429"><span>Before mounting the file system, create a script named <strong id="sfs_01_0025__b14361753133312">auto_mount.bat</strong>, save the script to a local host, and record the save path. The script contains the following content:</span><p><pre class="screen" id="sfs_01_0025__screen19780739141315">mount -o nolock <em id="sfs_01_0025__i2720731222">mount point</em> <em id="sfs_01_0025__i838063616216">corresponding drive letter</em></pre>
|
|
<div class="fignone" id="sfs_01_0025__fig16219105811227"><span class="figcap"><b>Figure 2 </b>Saving the script</span><br><span><img id="sfs_01_0025__image9219185822215" src="en-us_image_0000001516396456.png"></span></div>
|
|
<p id="sfs_01_0025__p598813910337">For example, the <strong id="sfs_01_0025__b1949524564414">auto_mount.bat</strong> script of a file system contains the following content:</p>
|
|
<p id="sfs_01_0025__p118411845448">For SFS Capacity-Oriented file systems: <strong id="sfs_01_0025__b1279744214423">mount -o nolock</strong> <i><span class="varname" id="sfs_01_0025__varname1679884216429">mount point</span></i> <strong id="sfs_01_0025__b579811428428">X:</strong></p>
|
|
<p id="sfs_01_0025__p4687135362817">For SFS Turbo file systems: <strong id="sfs_01_0025__b737074464215">mount -o nolock -o casesensitive=yes</strong> <em id="sfs_01_0025__i12371344154213">IP address</em><strong id="sfs_01_0025__b14371124434212">:/!</strong> <strong id="sfs_01_0025__b85813222295">X:</strong></p>
|
|
<div class="note" id="sfs_01_0025__note12279133834418"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="sfs_01_0025__ul085211314379"><li id="sfs_01_0025__li1185219314376">You can copy the mount command of the file system from the console.</li><li id="sfs_01_0025__li085263113710">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 <strong id="sfs_01_0025__b9147653192710">This PC</strong> after the script execution, the script can be executed properly.</li><li id="sfs_01_0025__li38524353712">This .bat script cannot be stored in the same path in <a href="#sfs_01_0025__li1575462317355">4</a> that stores the .vbs file. In this example, the .bat script is stored in <strong id="sfs_01_0025__b13417152942919">C:\test\</strong>.</li></ul>
|
|
</div></div>
|
|
</p></li><li id="sfs_01_0025__li1575462317355"><a name="sfs_01_0025__li1575462317355"></a><a name="li1575462317355"></a><span>Create a .txt file whose name is <em id="sfs_01_0025__i487814181336">XXX</em><strong id="sfs_01_0025__b38441523531">.vbs</strong> and save the file to the directory <strong id="sfs_01_0025__b14560102615121">C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup</strong>. The file contains the following content: </span><p><pre class="screen" id="sfs_01_0025__screen4819104568">set ws=WScript.CreateObject("WScript.Shell")
|
|
ws.Run "<em id="sfs_01_0025__i131717571986">Local path and script name of the auto_mount.bat script</em> /start", 0</pre>
|
|
<div class="fignone" id="sfs_01_0025__fig1231574312415"><span class="figcap"><b>Figure 3 </b>Creating .vbs file</span><br><span><img id="sfs_01_0025__image13151443172416" src="en-us_image_0000001515917320.png"></span></div>
|
|
<div class="note" id="sfs_01_0025__note112153387250"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="sfs_01_0025__p15215038122510">In this example, the local path of the <strong id="sfs_01_0025__b18423145103118">auto_mount.bat</strong> script is <strong id="sfs_01_0025__b11230111553118">C:\test\</strong>. Therefore, the content in the .vbs file is as follows:</p>
|
|
<pre class="screen" id="sfs_01_0025__screen766321617269">set ws=WScript.CreateObject("WScript.Shell")
|
|
ws.Run "C:\test\auto_mount.bat /start",0</pre>
|
|
</div></div>
|
|
</p></li><li id="sfs_01_0025__li43793713323"><span>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 <strong id="sfs_01_0025__b194511538163112">This PC</strong>.</span></li></ol>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="sfs_01_0024.html">Mount a File System</a></div>
|
|
</div>
|
|
</div>
|
|
|