Expand the Capacity of LVM

<p class="shortdesc">When the capacity of a logical volume is insufficient, you can dynamically expand its capacity online. </p> <section class="section context"><div class="tasklabel"><h2 class="doc-tairway">About this task</h2></div> <p class="p">When you expand the capacity of the logical volume, you also need to expand the size of the file system on this volume. Therefore, if you need to expand the capacity, expand the capacity of the logical volume first and then the size of the file system. </p> </section> <section id="expandlvm__steps_mkt_b44_tlb"><div class="tasklabel"><h2 class="doc-tairway">Procedure</h2></div><ol class="ol steps" id="expandlvm__steps_mkt_b44_tlb"><li class="li step stepexpand"> <span class="ph cmd">Expand the capacity of the logical volume. </span> <div class="itemgroup info"> <pre class="pre codeblock"><code>lvextend -L +/- <Capacity> <Logical volume path> </code></pre> <p class="p">Examples</p> <pre class="pre codeblock"><code>//Example 1: Increase the capacity of 1v1 by 350M 1vextend -L +350M /dev/1vm_example/1v1 //Example 2: Allocate all free spaces of the volume group where 1v1 is located to 1v1 1vextend –1 +100%FREE /dev/1vm_example/1v1</code></pre> </div> </li><li class="li step stepexpand"> <span class="ph cmd">Expand the size of the file system. </span> <div class="itemgroup info"> <pre class="pre codeblock"><code>resize2fs <Logical volume path></code></pre> <p class="p">For example, run the command: </p> <pre class="pre codeblock"><code>resize2fs /dev/1vm_example/1v1</code></pre> <img class="image" id="expandlvm__image_t3n_xrj_tlb" src="https://obs-cn-shanghai.yun.pingan.com/pcp-portal/20200707171843-1bbdebb7980e.png"> </div> </li><li class="li step stepexpand"> <span class="ph cmd">View the capacity of the expanded logical volume. </span> <div class="itemgroup info"> <pre class="pre codeblock"><code>df -h</code></pre> <img class="image" id="expandlvm__image_pld_2p4_tlb" src="https://obs-cn-shanghai.yun.pingan.com/pcp-portal/20200707171843-1e2077659788.png"> <p class="p">You can see additional 1G of capacity has been added to the logical volume, and the total capacity has increased to 21G. </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