All Products
Search
Document Center

Elastic Compute Service:Extend an LV

Last Updated:Nov 04, 2025

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:

  1. 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).

  2. 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.

image

Procedure

Important

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

  1. Connect to your ECS instance.

    1. Go to ECS console - Instance. In the top navigation bar, select the target region and resource group.

    2. 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.

  2. Check the free space in the VG.

    Run the sudo vgs command. In the output, view the VG name in the VG column and the free space in the VFree column.

    sudo vgs
      VG    #PV #LV #SN Attr   VSize  VFree
      vg_01   2   1   0 wz--n- 79.99g    0 

    In 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.

  3. Extend the VG.

    Extend a PV in the VG

    1. Check the mapping between PVs and disks.

      Run the sudo pvs -a -o +devices command to identify the disk (in the Devices column) that corresponds to the PV (in the PV column). Record the names of the PV and the disk.

      sudo pvs -a -o +devices
        PV         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/vdb corresponds 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/vdc1 corresponds to the disk partition /dev/vdc1. The disk name is /dev/vdc, and the partition number is 1. You must extend the partition.

    2. Resize the disk.

      1. Go to ECS console - Block Storage. In the top navigation bar, select the target region and resource group.

      2. In the Actions column for the target disk, click Resize.

      3. On the Determine Disk and Read Notes page, review the information and then click I Understand Risks and Have Backed Up Data. Proceed.

      4. 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.
        Important

        You are charged for the additional capacity when you resize a disk.

      5. (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.
    3. (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.

      Important

      Ensure 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, run sudo LC_ALL=en_US.UTF-8 growpart /dev/vdc 1.

      If the output contains the keyword CHANGED, the command succeeded.

    4. 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, run sudo pvresize /dev/vdb.

      If the output contains the phrase 1 physical volume(s) resized or updated, the command succeeded.

    5. Verify that the VG is extended.

      Run sudo vgs and verify that the VFree value has increased as expected.

      sudo vgs
      VG    #PV #LV #SN Attr   VSize  VFree 
      vg_01   2   1   0 wz--n- 89.99g 10.00g

      In this example, the capacity of the vg_01 VG increased from 79.99 GiB to 89.99 GiB, and the free space VFree is 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.

    1. Find the device name of the new data disk.

      Run sudo lsblk -f. Based on the NAME and FSTYPE columns, identify the device name of the new data disk.

      sudo lsblk -f
      NAME         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
      vdd

      In this example, the device vdd has no partitions and its FSTYPE is empty, which indicates it is the new data disk.

    2. Create a PV and add it to the VG.

      Important

      The 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 vdd as a PV and add it to the VG vg_01, run sudo vgextend vg_01 /dev/vdd.

      If the output contains the phrase successfully extended, the command succeeded.

    3. Verify that the VG is extended.

      Run sudo vgs and check if the total capacity of the VG (the value in the VSize column) has increased as expected.

      sudo vgs
      VG    #PV #LV #SN Attr   VSize   VFree  
      vg_01   3   1   0 wz--n- <89.99g <10.00g

      In this example, the capacity of the vg_01 VG increased from 79.99 GiB to 89.99 GiB, and the free space VFree is approximately 10 GiB. This matches the expectation, and the VG has been successfully extended.

Step 2: Extend the LV

  1. Get the path of the LV.

    Run sudo lvdisplay and note the LV Path value. 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     256

    In this example, the path of the LV lv01 is /dev/vg_01/lv01.

  2. 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, run sudo lvextend -L +10G /dev/vg_01/lv01.

    A successfully resized message indicates success.

  3. Extend the file system.

    1. Run the sudo lsblk -f command. In the output, record the FSTYPE and MOUNTPOINT for your LV. You need this information to select the correct command to extend the file system.

      sudo lsblk -f                                 
      NAME         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

      In this example, for the LV /dev/vg_01/lv01, the file system type is xfs and the mount point is /mnt/lv01.

    2. 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), run sudo 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, run sudo xfs_growfs /mnt/lv01.
    3. Check if the file system is successfully extended.

      Run sudo df -Th and verify that the Size column 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 space error when extending an LV?

    When you extend an LV, the capacity you add must not exceed the available space in the VG.

    1. Check the free space in the VG.

      Run the sudo vgs command and check the free space in the VFree column.

      sudo vgs
      VG    #PV #LV #SN Attr   VSize  VFree 
      vg_01   2   1   0 wz--n- 89.99g 10.00g

      In this example, the capacity added cannot exceed 10 GiB.

    2. 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>