Help Center/ Elastic Volume Service/ Best Practices/ Using LVM to Manage EVS Disks/ Implementation Procedure/ Extending the Logical Volume by Expanding Capacity of an EVS Disk
Updated on 2023-06-21 GMT+08:00

Extending the Logical Volume by Expanding Capacity of an EVS Disk

Scenarios

If the logical volume space becomes insufficient, you can extend the logical volume. This section describes how to add 10 GB space to a 19 GB logical volume by expanding the capacity of an EVS disk.

Procedure

  1. Expand the capacity of an EVS disk on the management console.

    1. Log in to the management console.
    2. Under Storage, click Elastic Volume Service. The disk list page is displayed.
    3. Locate the to-be-expanded disk and expand the capacity.

      For details, see Expanding Capacity for an In-use EVS Disk.

  2. Log in to the ECS as user root.
  3. Run the following command to check whether the system has identified the added space:

    fdisk -l

    Information similar to the following is displayed:

    The size of /dev/vdb has increased from 10 GB to 20 GB.

  4. Run the following command to view information of physical volumes:

    pvdisplay

    Information similar to the following is displayed:

    The size of /dev/vdb remains 10 GB, indicating that the size of the physical volume is not increased.

  5. Run the following command to extend the physical volume of the corresponding EVS disk:

    pvresize -v Disk device name

    In this example, run the following command:

    pvresize -v /dev/vdb

    Information similar to the following is displayed:

    In the command output, the physical volume corresponding to /dev/vdb has been extended.

  6. Run the following command to extend the corresponding logical volume if needed:

    lvextend -l +100%FREE Logical volume path

    In this example, run the following command:

    lvextend -l +100%FREE /dev/vgdata/lvdata1

    Information similar to the following is displayed:

  7. Run the following command to extend the file system of the partition:

    resize2fs Logical volume path

    In this example, run the following command:

    resize2fs /dev/vgdata/lvdata1

    Information similar to the following is displayed:

  8. Run the following command to view the capacity expansion result:

    lvdisplay

    Information similar to the following is displayed:

    In the command output, 10 GB is added to the LV Size logical volume.