Precautions
  • For virtual machines using LVM.
  • To expand the size of a single virtual machine disk.
  • The virtual machine in CuriosityCloud supports disk capacity expansion upon power-on and adding a new disk.
  • The virtual machine system part in this manual is to demonstrate a
  • Feasible way of capacity expansion and the process of Linux capacity expansion. It is not the only way to expand capacity. The operator should fully understand the meaning of various commands and parameters in the demonstration and be able to make corresponding adjustments according to actual needs.
  • The IDE disk type does not support thermal expansion of the disk. You need to install Vmtools.
  • The virtual machine deployed from Quick Deployment does not support system disk expansion.


Pre requirements

It is necessary to install VMTools and have Virtio enabled for Hot Disk expansion.

Below is a demonstration of using CentOS to extend the capacity of the root directory mount point.

Edit virtual machine: Click More > Edit.

Adjust disk size: Adjust the disk to the planned size. In this demo, adjust the disk from 50GB to 80GB and click OK after modification. If the virtual machine is turned off, turn it on and enter the console.

View current information: View the information of the expanded disk through the «lsblk» command. Disk is «/dev/vda», vg is «volgroup» and lv is «/dev/ volgroup/lv_root».

Disk partition: Enter the disk partition through “fdisk /dev/vda” and enter “p” to view the current partition. At this time, the disk «/dev/vda» in the demo environment already has two primary partitions. Add a new partition number of 3, new partition device name of «/dev/vda3» and the cylinder starts from 83221.

Create new partition: Enter «n» to create a new partition; enter «p» to create a primary partition. Enter the partition number, first cylinder, last cylinder, and then enter «w» to save the partition information and exit fdisk.

partx: After modifying the disk partition table, you can check whether the partition is recognized by using the «lsblk» command. If no new partition is recognized, there is no need to reboot. With the «partx» command, the kernel can read the information from the new partition table.

Check if the partition is recognized.

Convert the newly added partition to PV and add it to VG and LV. After expanding the logical volume, use resize2fs to resize the partition to use the expanded space.

View the LV size after capacity expansion: You can view the LV size after capacity expansion through the DF command. The capacity expansion is complete.

Tabla de contenidos