yzbtdiy

yzbtdiy

github
bilibili

ESXI Linux virtual machine online disk expansion

When encountering a virtual machine using ESXI at work that requires disk expansion, simulate the expansion process by installing an ESXI environment locally.

image

The size of the virtual machine's hard disk can be dynamically adjusted without shutting down the virtual machine, while the CPU and memory must be adjusted with the virtual machine turned off.

Scenario: Expand the existing disk directly without adding a new disk#

Adjust the virtual machine's hard disk size to 24G.

image

After the adjustment, the size of the virtual machine's disk has not changed. Enter
echo 1 > /sys/block/sda/device/rescan
to notify the kernel to rescan the disk, and after a moment, the disk size will change.

image

Use the parted command to adjust the disk size. First, check the total space and allocated space.

image

In the parted command line, use the resizepart command to adjust the partition size. After the adjustment, the size of the second partition changes.

image

Since a logical volume is used, the physical volume size needs to be adjusted using pvresize.

image

Expand the logical volume.

image

image

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.