Extend Root Volume for ext4 Filesystem in Proxmox
Steps to Extend the Root Logical Volume (/)
-
Backup Your Data
- Ensure critical data is backed up before performing volume operations.
-
Check Current Volume Group and Logical Volume
vgdisplay lvdisplay -
Extend the Logical Volume
- Use
lvextendto extend the logical volume for your root filesystem.
lvextend -l +100%FREE /dev/vg0/root- This command will use all available free space in the volume group to extend the root logical volume.
- Use
-
Resize the Filesystem
- After extending the logical volume, resize the filesystem to use the new space.
resize2fs /dev/vg0/root -
Verify the Resize
- Check that the root filesystem now reflects the increased size.
df -h /
- Check that the root filesystem now reflects the increased size.
Detailed Commands and Example
Extending the Logical Volume
lvextend -l +100%FREE /dev/vg0/root
- This command extends the logical volume
rootby using all free physical extents (PE) available in the volume groupvg0.
Resizing the Filesystem
resize2fs /dev/vg0/root
Verifying the Filesystem Size
df -h /
Example Workflow
Assume you have an ext4 filesystem on /dev/vg0/root. The steps would be as follows:
-
Extend the Logical Volume
lvextend -l +100%FREE /dev/vg0/root -
Resize the Filesystem
resize2fs /dev/vg0/root -
Verify the New Size
df -h /
Important Considerations
- Live Resize: Typically, these operations can be done on a live system. However, it’s safer to minimize system activity during the resize process.
- Monitoring: After extending and resizing, monitor your system to ensure everything works as expected.
- Free Space: If you don’t want to use all the free space, you can specify a smaller size using the
-Loption inlvextend, such as-L +100Gto add 100 GiB.
Summary
By following these steps, you can extend your root logical volume (/dev/vg0/root) to utilize the available free space in the vg0 volume group, effectively increasing the storage available to your Proxmox root filesystem without needing to reinstall or repartition your RAID array.