To extend a logical volume (LV), its volume group (VG) must have free space. If needed, first extend the VG by adding a new disk or resizing an existing one. Then, extend the LV and its file system to complete the process.
How it works
To extend an LV:
-
Extend the VG: An LV is allocated from a VG. First, increase the VG capacity by extending or adding a physical volume (PV).
-
Extend the LV : Allocate free space from the VG to the target LV, then extend its file system.
Procedure
Logical Volume Manager (LVM) does not provide data redundancy. For production data, implement redundancy at the application layer or use snapshot consistency groups to protect your data.
Step 1: Extend the VG
-
Connect to the ECS instance.
-
Go to ECS console - Instances. In the top-left corner, select the region and resource group for the target resource.
-
On the instance details page, click Connect > Workbench. Log on and open the terminal.
-
-
Check the free space in the VG.
Run
sudo vgs. Note the VG name in theVGcolumn and the free space in theVFreecolumn.sudo vgsVG #PV #LV #SN Attr VSize VFree vg_01 2 1 0 wz--n- 79.99g 0In this example, the VG
vg_01has 79.99 GiB total capacity and 0 GiB free space. You must first extend the VG. If the VG has free space, directly extend the LV. -
Extend the VG.
Extend a PV in the VG
-
Check the mapping between PVs and disks.
Run
sudo pvs -a -o +devices. Match the disk (in theDevicescolumn) to the PV (in thePVcolumn). Record the PV and disk names.sudo pvs -a -o +devicesPV VG Fmt Attr PSize PFree Devices /dev/vda1 --- 0 0 /dev/vda2 --- 0 0 /dev/vda3 --- 0 0 /dev/vdb vg_01 lvm2 a-- <40.00g 0 /dev/vdb(0) /dev/vdc1 vg_01 lvm2 a-- <40.00g 0 /dev/vdc1(0)-
If the PV uses an entire disk (no partitions), resize the disk only. In this example, PV
/dev/vdbmaps to disk/dev/vdbwith no partitions. -
If the PV uses a disk partition, resize the disk and then extend the partition. In this example, PV
/dev/vdc1corresponds to partition/dev/vdc1on disk/dev/vdc, partition 1.
-
-
Resize the disk.
-
Go to ECS console - Block Storage - Cloud Disks. In the top-left corner, select the region and resource group for the target resource.
-
In the Actions column, click Resize.
-
On the Determine Disk and Read Notes page, review the notes and click I Understand Risks and Have Backed Up Data. Proceed.
-
On the Configure Resizing Method and New Size page, set the parameters, confirm the fee, and click Resize.
Example: to resize a disk from 40 GiB to 50 GiB, set New Disk Size to 50 GiB.
ImportantYou are charged for the additional capacity when you resize a disk.
-
(Conditional) For subscription disks, wait for the 5-second countdown in the payment dialog box, click Complete Payment, complete the payment, return to the resize page, and click Paid. Close the dialog box.
If you click Paid. Close the dialog box. without completing the payment, click Go to Order Center to complete the payment.
-
-
(Conditional) If the PV is on a disk partition, extend the partition.
Replace
<disk_name>and<partition_number>with values from Step a.ImportantEnsure a space separates the disk name and the partition number.
sudo LC_ALL=en_US.UTF-8 growpart <disk_name> <partition_number>Example: to extend
/dev/vdc1, runsudo LC_ALL=en_US.UTF-8 growpart /dev/vdc 1.A
CHANGEDkeyword in the output indicates success. -
Extend the PV.
Replace
<physical_volume_name>with the value from Step a.sudo pvresize <physical_volume_name>Example: to extend PV
/dev/vdb, runsudo pvresize /dev/vdb.A
1 physical volume(s) resized or updatedmessage indicates success. -
Verify that the VG is extended.
Run
sudo vgsand verify thatVFreeincreased as expected.sudo vgsVG #PV #LV #SN Attr VSize VFree vg_01 2 1 0 wz--n- 89.99g 10.00gIn this example, VG
vg_01grew from 79.99 GiB to 89.99 GiB withVFreeat 10 GiB, confirming the VG is extended.
Add a new PV to the VG
Before you proceed, create a new disk and attach it to the target instance. Do not initialize the disk.
-
Find the device name of the new data disk.
Run
sudo lsblk -f. Identify the new disk by itsNAMEand emptyFSTYPE.sudo lsblk -fNAME FSTYPE LABEL UUID MOUNTPOINT vda ├─vda1 ├─vda2 vfat 7938-FA03 /boot/efi └─vda3 ext4 root 33b46ac5-7482-4aa5-8de0-60ab4c3a4c78 / vdb LVM2_member okx24E-qSjZ-zv9l-lOkm-Pcxu-q6KX-qzRcCu └─vg_01-lv01 xfs 9e2bfe15-074e-4bf5-aac5-62c58299364f /mnt/lv01 vdc LVM2_member ISeUSM-AhRp-KdNN-7pWJ-HxGW-2AEq-85m9dE └─vg_01-lv01 xfs 9e2bfe15-074e-4bf5-aac5-62c58299364f /mnt/lv01 vddIn this example,
vddhas no partitions and an emptyFSTYPE, indicating it is the new data disk. -
Create a PV and add it to the VG.
ImportantThe vgextend command initializes the disk as a PV and deletes all data on it. Ensure the disk is empty.
Replace
<new_disk_device_name>with the value from the previous step.sudo vgextend <volume_group_name> /dev/<new_disk_device_name>Example: to add disk
vddto VGvg_01, runsudo vgextend vg_01 /dev/vdd.A
successfully extendedmessage indicates success. -
Verify that the VG is extended.
Run
sudo vgsand verify thatVSizeincreased as expected.sudo vgsVG #PV #LV #SN Attr VSize VFree vg_01 3 1 0 wz--n- <89.99g <10.00gIn this example, VG
vg_01grew from 79.99 GiB to 89.99 GiB withVFreeat approximately 10 GiB, confirming the VG is extended.
-
Step 2: Extend the LV
-
Get the path of the LV.
Run
sudo lvdisplayand note theLV Pathvalue for use in a later step.sudo lvdisplay--- Logical volume --- LV Path /dev/vg_01/lv01 LV Name lv01 VG Name vg_01 LV UUID DAD6Fy-4lbd-9EW9-UTvx-rGti-hYss-txxxxx LV Write Access read/write LV Creation host, time iZbp1hww2c2kyj54i1xxxxx, 2025-09-22 10:37:58 +0800 LV Status available # open 1 LV Size 79.99 GiB Current LE 20478 Segments 2 Allocation inherit Read ahead sectors auto - currently set to 256In this example, the path of the LV
lv01is/dev/vg_01/lv01. -
Extend the LV.
sudo lvextend -L +<logical_volume_size> <logical_volume_path>Parameter
Description
<logical_volume_size>
The space to add. Must not exceed the free space in the VG.
<logical_volume_path>
The path of the LV to resize, obtained in the previous step.
For example, to add 10 GiB to the LV at
/dev/vg_01/lv01, runsudo lvextend -L +10G /dev/vg_01/lv01.A
successfully resizedmessage indicates success. -
Extend the file system.
-
Run
sudo lsblk -f. Record theFSTYPEandMOUNTPOINTfor your LV.sudo lsblk -fNAME FSTYPE LABEL UUID MOUNTPOINT vda ├─vda1 ├─vda2 vfat 7938-FA03 /boot/efi └─vda3 ext4 root 33b46ac5-7482-4aa5-8de0-60ab4c3a4c78 / vdb LVM2_member okx24E-qSjZ-zv9l-lOkm-Pcxu-q6KX-qzRcCu └─vg_01-lv01 xfs 9e2bfe15-074e-4bf5-aac5-62c58299364f /mnt/lv01 vdc LVM2_member ISeUSM-AhRp-KdNN-7pWJ-HxGW-2AEq-85m9dE └─vg_01-lv01 xfs 9e2bfe15-074e-4bf5-aac5-62c58299364f /mnt/lv01In this example, LV
/dev/vg_01/lv01has file system typexfsand mount point/mnt/lv01. -
Extend the file system.
-
For ext2, ext3, or ext4 file systems:
Replace
<logical_volume_path>with the path obtained for the LV.sudo resize2fs <logical_volume_path>Example: to extend LV
lv01(path/dev/vg_01/lv01), runsudo resize2fs /dev/vg_01/lv01. -
For xfs file systems:
Replace
<mount_point>with the mount point obtained for the LV.sudo xfs_growfs <mount_point>Example: to extend the LV mounted at
/mnt/lv01, runsudo xfs_growfs /mnt/lv01.
-
-
Verify that the file system is extended.
Run
sudo df -Thand verify that theSizecolumn reflects the new LV capacity.File systems reserve some capacity for metadata, so the reported size may be slightly smaller than the LV capacity. See Why does the df command show a different disk capacity than purchased?
-
Billing
Extending an LV may incur the following fees.
-
If you increase the capacity of an existing PV:
You are billed for the additional disk capacity. The billing method for the added capacity matches that of the original disk.
-
For subscription disks: You are charged a one-time fee for the added capacity, which covers the remainder of your subscription term.
Price difference = (Monthly price / 30 days) × Remaining duration × Added capacity.
Remaining duration is measured in days, accurate to the second.
-
For pay-as-you-go disks: The new, higher rate applies from the next billing hour.
-
-
If you add a new PV:
You are billed for the new disk as soon as it is created, regardless of whether it is attached to an instance. Charges depend on the disk type and region and may include fees for capacity, provisioned performance, and burst performance.
FAQ
-
Why do I get a "404 Not Found" error when installing tools?
CentOS 6 and Debian 9/10/11 have reached end of life (EOL). Switch the CentOS repository URL or the Debian 9/10/11 repository URL before installing tools.
-
What do I do if I get an
Insufficient free spaceerror when extending an LV?The capacity added to an LV must not exceed the available space in the VG.
-
Check the free space in the VG.
Run
sudo vgsand check theVFreecolumn.sudo vgsVG #PV #LV #SN Attr VSize VFree vg_01 2 1 0 wz--n- 89.99g 10.00gIn this example, the added capacity cannot exceed 10 GiB.
-
Allocate all remaining free space to the LV:
Replace
<logical_volume_path>with the path obtained for the LV.sudo lvextend -l +100%FREE <logical_volume_path>
-