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:
vgdisplay
Look for the "Free PE / Size" field. If there’s free space, you can extend the volume.
sudo lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
This command assigns all available free space to the volume.
sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
For XFS filesystem:
sudo xfs_growfs /home/user
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.
lsblk
Look for the main disk (e.g., nvme0n1) and check if there’s any unpartitioned free space. If there is:
Extend the Partition (if using LVM directly on a partition):
sudo parted /dev/nvme0n1
Type
If there’s free space, type:
resizepart 3 100%
(Replace 3 with the correct partition number for LVM.)
Exit parted by typing quit.
Resize the Physical Volume (PV):
sudo pvresize /dev/nvme0n1p3
(Replace nvme0n1p3 with the correct partition.)
Try Extending Again:
sudo lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv # for ext4