Thanos Blog

Extend Root Volume for ext4 Filesystem in Proxmox

25 Jun 2024

Extend Root Volume for ext4 Filesystem in Proxmox

Steps to Extend the Root Logical Volume (/)

  1. Backup Your Data

    • Ensure critical data is backed up before performing volume operations.
  2. Check Current Volume Group and Logical Volume

    vgdisplay
    lvdisplay
    
  3. Extend the Logical Volume

    • Use lvextend to 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.
  4. Resize the Filesystem

    • After extending the logical volume, resize the filesystem to use the new space.
    resize2fs /dev/vg0/root
    
  5. Verify the Resize

    • Check that the root filesystem now reflects the increased size.
      df -h /
      

Detailed Commands and Example

Extending the Logical Volume

lvextend -l +100%FREE /dev/vg0/root
  • This command extends the logical volume root by using all free physical extents (PE) available in the volume group vg0.

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:

  1. Extend the Logical Volume

    lvextend -l +100%FREE /dev/vg0/root
    
  2. Resize the Filesystem

    resize2fs /dev/vg0/root
    
  3. 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 -L option in lvextend, such as -L +100G to 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.