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_lcy_wsc_wmb" src="https://pcp-portal-sca.obs-cn-shenzhen.pinganyun.com/pcp-portal-sca/20200109111754-1e5e59769e3d.png"> <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://pcp-portal-sca.obs-cn-shenzhen.pinganyun.com/pcp-portal-sca/20200109111753-113db67c9e7e.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://pcp-portal-sca.obs-cn-shenzhen.pinganyun.com/pcp-portal-sca/20200109111753-1ebfb0bc967f.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_jsf_tkx_vmb" src="https://pcp-portal-sca.obs-cn-shenzhen.pinganyun.com/pcp-portal-sca/20200109111754-1561c774929d.png" width="800"> <p class="p">从显示信息中,可以看出,当前挂载的分区大小为30G,挂载目录为/mnt。</p> </div> </li></ol></section>
以上内容是否解决了您的问题?
请补全提交信息!
咨询·建议

电话咨询

400-151-8800

邮件咨询

cloud@pingan.com

在线客服

工单支持

解决云产品相关技术问题