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
Extending an LV consists of two main steps:
Extend the VG: An LV is allocated from a VG. Therefore, you must first increase the VG's capacity by extending or adding a physical volume (PV).
Extend the LV: Allocate the new space from the VG to the target LV, and then extend its file system to make the new space available to the operating system.
Procedure
Logical Volume Manager (LVM) does not provide data redundancy. For production data, implement a redundancy solution at the application layer or use Alibaba Cloud snapshot consistency groups to protect your data.
Step 1: Extend the VG
Connect to your ECS instance.
Go to ECS console - Instance. In the top navigation bar, select the target region and resource group.
Go to the details page of the target instance, click Connect and select Workbench. Follow the on-screen instructions to log on and open the terminal.
Check the free space in the VG.
Run the
sudo vgscommand. In the output, view 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 is named
vg_01, its total capacity is 79.99 GiB, and its free space is 0 GiB. You must first extend the VG. If the VG has free space, you can directly extend the LV.Extend the VG.
Extend a PV in the VG
Check the mapping between PVs and disks.
Run the
sudo pvs -a -o +devicescommand to identify the disk (in theDevicescolumn) that corresponds to the PV (in thePVcolumn). Record the names of the PV and the disk.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 was created on an entire disk (without partitions), you only need to resize the disk. In this example, the PV
/dev/vdbcorresponds to the disk/dev/vdb. It has no partitions, so you only need to resize it.If the PV was created on a partition of a disk, you must resize the disk and then extend the partition. In this example, the PV
/dev/vdc1corresponds to the disk partition/dev/vdc1. The disk name is/dev/vdc, and the partition number is 1. You must extend the partition.
Resize the disk.
Go to ECS console - Block Storage. In the top navigation bar, select the target region and resource group.
In the Actions column for the target disk, click Resize.
On the Determine Disk and Read Notes page, review the information and then click I Understand Risks and Have Backed Up Data. Proceed.
On the Configure Resizing Method and New Size page, set the resize parameters, confirm the fee, and then click OK.
For 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) If the disk is a subscription disk, wait for the 5-second countdown in the payment dialog box to end, 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 in the Actions column to complete the payment.
(Conditional) If the PV to be extended is on a disk partition, you must extend the partition within the ECS instance.
Run the following command. Replace
<disk_name>and<partition_number>with the disk name and partition number you recorded in Step a.ImportantEnsure there is a space between the disk name and the partition number.
sudo LC_ALL=en_US.UTF-8 growpart <disk_name> <partition_number>For example, to extend
/dev/vdc1, runsudo LC_ALL=en_US.UTF-8 growpart /dev/vdc 1.If the output contains the keyword
CHANGED, the command succeeded.Extend the PV.
Replace
<physical_volume_name>with the name you recorded in Step a.sudo pvresize <physical_volume_name>For example, to extend the PV
/dev/vdb, runsudo pvresize /dev/vdb.If the output contains the phrase
1 physical volume(s) resized or updated, the command succeeded.Verify that the VG is extended.
Run
sudo vgsand verify that theVFreevalue has increased as expected.sudo vgsVG #PV #LV #SN Attr VSize VFree vg_01 2 1 0 wz--n- 89.99g 10.00gIn this example, the capacity of the
vg_01VG increased from 79.99 GiB to 89.99 GiB, and the free spaceVFreeis now 10 GiB. This matches the expectation, and the VG has been successfully extended.
Add a new PV to the VG
Before you proceed, make sure you have created a new disk and attached it to the target instance. Do not initialize the disk.
Find the device name of the new data disk.
Run
sudo lsblk -f. Based on theNAMEandFSTYPEcolumns, identify the device name of the new data disk.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, the device
vddhas no partitions and itsFSTYPEis empty, which indicates it is the new data disk.Create a PV and add it to the VG.
ImportantThe vgextend command initializes the disk as a PV, which deletes all data on the disk. Ensure the disk is empty.
Replace
<new_disk_device_name>with the name you found in the previous step.sudo vgextend <volume_group_name> /dev/<new_disk_device_name>For example, to initialize the disk
vddas a PV and add it to the VGvg_01, runsudo vgextend vg_01 /dev/vdd.If the output contains the phrase
successfully extended, the command succeeded.Verify that the VG is extended.
Run
sudo vgsand check if the total capacity of the VG (the value in theVSizecolumn) has increased as expected.sudo vgsVG #PV #LV #SN Attr VSize VFree vg_01 3 1 0 wz--n- <89.99g <10.00gIn this example, the capacity of the
vg_01VG increased from 79.99 GiB to 89.99 GiB, and the free spaceVFreeis approximately 10 GiB. This matches the expectation, and the VG has been successfully extended.
Step 2: Extend the LV
Get the path of the LV.
Run
sudo lvdisplayand note theLV Pathvalue. You will need this path 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 amount of space to add. This value must not exceed the free space in the VG.
<logical_volume_path>
The path of the LV that you want to resize, which you 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 the
sudo lsblk -fcommand. In the output, record theFSTYPEandMOUNTPOINTfor your LV. You need this information to select the correct command to extend the file system.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, for the LV
/dev/vg_01/lv01, the file system type isxfsand the mount point is/mnt/lv01.Extend the file system.
For ext2, ext3, or ext4 file systems:
Replace
<logical_volume_path>with the path you obtained for the LV.sudo resize2fs <logical_volume_path>For example, to extend the LV
lv01(path/dev/vg_01/lv01), runsudo resize2fs /dev/vg_01/lv01.For xfs file systems.
Replace
<mount_point>with the mount point you obtained for the LV.sudo xfs_growfs <mount_point>For example, to extend the LV mounted at
/mnt/lv01, runsudo xfs_growfs /mnt/lv01.
Check if the file system is successfully extended.
Run
sudo df -Thand verify that theSizecolumn reflects the new capacity of the LV.Because a file system reserves some capacity for metadata, its reported size might be slightly smaller than the LV's capacity. For more information, see Why does the df command show a different disk capacity than purchased?
Billing
When you extend an LV, the following fees may apply.
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.
The remaining duration is measured in days and is 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.
For more information, see Elastic Block Storage billing.
FAQ
Why do I get a "404 Not Found" error when installing tools?
The CentOS 6 and Debian 9/10/11 operating systems have reached their end of life (EOL). To install the tools, you must first switch the CentOS repository URL or the Debian 9/10/11 repository URL.
What do I do if I get an
Insufficient free spaceerror when extending an LV?When you extend an LV, the capacity you add must not exceed the available space in the VG.
Check the free space in the VG.
Run the
sudo vgscommand and check the free space in theVFreecolumn.sudo vgsVG #PV #LV #SN Attr VSize VFree vg_01 2 1 0 wz--n- 89.99g 10.00gIn this example, the capacity added cannot exceed 10 GiB.
Allocate all remaining free space to the LV.
Replace
<logical_volume_path>with the path you obtained for the LV to be extended.sudo lvextend -l +100%FREE <logical_volume_path>