Linux系统中云硬盘扩容后处理(使用growpart)

<p class="shortdesc">本章节主要介绍基于Linux系统的云硬盘扩容后,如何使用growpart工具进行分区扩容。</p> <section class="section context" id="linuxgrowpart__context_rgd_tjb_vmb"><div class="tasklabel"><h2 class="doc-tairway">背景信息</h2></div> <p class="p">Linux操作系统版本为CentOS7.2_64bit,已经挂载一块数据盘</p> <p class="p">扩容前的数据盘只有一个主分区(/dev/vdb1),ext4文件系统,挂载点/mnt,扩容前20G,扩容后30G,扩容完成后数据盘仍只有一个主分区。</p> </section> <section id="linuxgrowpart__steps_sgd_tjb_vmb"><div class="tasklabel"><h2 class="doc-tairway">操作步骤</h2></div><ol class="ol steps" id="linuxgrowpart__steps_sgd_tjb_vmb"><li class="li step stepexpand"> <span class="ph cmd">远程连接云服务器ECS实例。</span> </li><li class="li step stepexpand"> <span class="ph cmd">查看磁盘当前的挂载信息。</span> <div class="itemgroup info"> <pre class="pre codeblock"><code>df -TH</code></pre> <img class="image" id="linuxgrowpart__image_dpk_nwl_slb" src="https://obs-cn-shanghai.yun.pingan.com/pcp-portal/20203108172146-199d64349b0a.png" width="800"> <p class="p">从显示信息中可以看到,/dev/vdb1当前容量是20G ,文件系统类型为ext4,挂载路径为/mnt。</p> </div> </li><li class="li step stepexpand"> <span class="ph cmd">安装growpart工具。</span> <div class="itemgroup info"> <pre class="pre codeblock"><code>yum install cloud-utils-growpart</code></pre> </div> </li><li class="li step stepexpand"> <span class="ph cmd">对vdb分区1进行扩容。</span> <div class="itemgroup info"> <pre class="pre codeblock"><code>growpart /dev/vdb 1</code></pre> <img class="image" id="linuxgrowpart__image_ipd_khx_vmb" src="https://obs-cn-shanghai.yun.pingan.com/pcp-portal/20203108172146-1b38a0bf9234.png" width="800"> </div> </li><li class="li step stepexpand"> <span class="ph cmd">刷新文件系统大小。</span> <div class="itemgroup info"> <pre class="pre codeblock"><code>resize2fs /dev/vdb1</code></pre> <img class="image" id="linuxgrowpart__image_fbp_4hx_vmb" src="https://obs-cn-shanghai.yun.pingan.com/pcp-portal/20203108172146-11882acb9c6c.png" width="800"> </div> </li><li class="li step stepexpand"> <span class="ph cmd">查看挂载结果。</span> <div class="itemgroup info"> <pre class="pre codeblock"><code>df -TH</code></pre> <img class="image" id="linuxgrowpart__image_drr_rhx_vmb" src="https://obs-cn-shanghai.yun.pingan.com/pcp-portal/20203108172146-1ff105bf93a6.png" width="800"> <p class="p">从显示信息中,可以看出,当前挂载的分区大小为30G,挂载目录为/mnt。</p> </div> </li></ol></section>
Did the above content solve your problem? Yes No
Please complete information!

Call us

400-151-8800

Email us

cloud@pingan.com

Online customer service

Instant reply

Technical Support

cloud products