KB 198005 - Resolving "No Space Left on Device" While Extending an LVM Volume in Ubuntu

KB 198005 - Resolving "No Space Left on Device" While Extending an LVM Volume in Ubuntu


When you are trying to extend your LVM (Logical Volume Manager) partition but encountered a "No space left on device" error. Your home directory (/home/user) is mounted on /dev/mapper/ubuntu--vg-ubuntu--lv, which is already at 100% usage.

Here’s how you can increase the home directory size by extending the logical volume:

Step 1: Check Available Free Space

Run the following command to check how much free space is available in your LVM volume group:
  1. vgdisplay

Look for the "Free PE / Size" field. If there’s free space, you can extend the volume.


Step 2: Extend the Logical Volume

If free space is available in your volume group, extend your home directory's logical volume by running:
  1. sudo lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv

This command assigns all available free space to the volume.


Step 3: Resize the Filesystem

After extending the logical volume, you need to resize the filesystem to use the new space:
For ext4 filesystem (most common):
  1. sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

For XFS filesystem:

  1. sudo xfs_growfs /home/user

Step 4: Verify the Changes

Check if the space has been added successfully:
  1. df -h /home/user

If your volume group is full and there’s no free space left in it, you will need to add a new physical volume (another disk or partition) and extend the volume group.

When volume group is full

  1. unable to run sudo lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv its showing no space left

Solution 1: Check If There’s Unallocated Space on the Disk

  1. lsblk

Look for the main disk (e.g., nvme0n1) and check if there’s any unpartitioned free space. If there is:

  1. Extend the Partition (if using LVM directly on a partition):

    sudo parted /dev/nvme0n1
  2. Type print to see partitions.
    1. If there’s free space, type:


      resizepart 3 100%

      (Replace 3 with the correct partition number for LVM.)

    • Exit parted by typing quit.

  3. Resize the Physical Volume (PV):

    sudo pvresize /dev/nvme0n1p3

    (Replace nvme0n1p3 with the correct partition.)

  4. Try Extending Again:

    sudo lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv # for ext4