Extending an LVM Volume on a Constantly Written Virtual Disk (vmdisk)
This guide explains how to safely extend an LVM volume that uses a virtual disk (vmdisk) without affecting existing data.
1. Extend the Virtual Disk in the Hypervisor
If not already done, extend the virtual disk size from your hypervisor (e.g., Proxmox, VMware, etc.).
2. Detect the Resized Disk
On the guest operating system, rescan the disk to detect the new size:
Then check the disk size:
3. Resize the Partition
If the disk used by LVM has a partition that does not cover the newly allocated space, resize the partition. Follow these steps:
Using parted
:
- Start
parted
: - View the current partitions:
- Resize the partition: Example:
- Exit
parted
:
Using fdisk
(for MBR partitions):
- Start
fdisk
: - Note the starting sector of the current partition (
Start
). - Delete the current partition (
d
) and recreate it (n
) using the same starting sector. The new size will occupy all available space. - Save changes with:
4. Resize the LVM Physical Volume
Update the LVM physical volume to reflect the new size:
5. Extend the Logical Volume
Extend the logical volume using the additional space:
-
To add a specific size (e.g., 10GB):
-
To use all the available free space:
6. Extend the Filesystem
Resize the filesystem to use the newly extended space:
-
For ext4:
-
For xfs:
7. Final Verification
Ensure the resizing was successful:
Important Note
Extending an LVM volume with constant writes is safe if the steps are followed correctly. However, it is recommended to back up critical data before making any changes.