Extending the Logical Volume Using the Unallocated Space
Scenarios
If the logical volume space becomes insufficient, you can extend the logical volume. This section shows how to add 4 GB space to a 15 GB logical volume, which no longer meets requirements.

During the extension, ensure that the volume group has sufficient available space to extend the logical volume. If the volume group's available space is also insufficient, extend the volume group according to Extending the Logical Volume by Expanding Capacity of an EVS Disk or Extending the Volume Group by Adding an EVS Disk.
Procedure
- Log in to the ECS as user root.
For how to log in to an ECS, see Logging In to an ECS.
- Extend the logical volume.
lvextend -L +<additional-capacity> <logical-volume-path>
Parameter description:
- <additional-capacity>: Specify a value smaller than the volume group's available space, either in MB or GB.
- <logical-volume-path>: Specify the path of the to-be-extended logical volume.
Example command:
lvextend -L +4GB /dev/vgdata/lvdata1
Information similar to the following is displayed:
[root@ecs-lvmtest ~]# lvextend -L +4GB /dev/vgdata/lvdata1 Size of logical volume vgdata/lvdata1 changed from 15.00 GiB (3840 extents) to 19.00 GiB (4864 extents). Logical volume vgdata/lvdata1 successfully resized.
This step only extends the logical volume. You also need to extend the size of the file system on this volume.
- Extend the size of the file system.
resize2fs <logical-volume-path>
Example command:
resize2fs /dev/vgdata/lvdata1
Information similar to the following is displayed:
[root@ecs-lvmtest ~]# resize2fs /dev/vgdata/lvdata1 resize2fs 1.42.9 (28-Dec-2013) Filesystem at /dev/vgdata/lvdata1 is mounted on /Data1; on-line resizing required old_desc_blocks = 4, new_desc_blocks = 28 The filesystem on /dev/vgdata/lvdata1 is now 3657728 blocks long.
- Check whether the file system size increases.
df -h
Information similar to the following is displayed:
[root@ecs-lvmtest ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/vda2 39G 1.5G 35G 5% / devtmpfs 487M 0 487M 0% /dev tmpfs 496M 0 496M 0% /dev/shm tmpfs 496M 6.7M 490M 2% /run tmpfs 496M 0 496M 0% /sys/fs/cgroup /dev/vda1 976M 131M 779M 15% /boot tmpfs 100M 0 100M 0% /run/user/0 /dev/mapper/vgdata-lvdata1 19G 44M 18G 1% /Data1
In the command output, the size of file system /dev/mapper/vgdata-lvdata1 increases by 4 GB.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot