1

I use an lvm, one for /home and another for /root (and another for swap, but that doesn't matter here). This lvm consists of 2 hard drives: one is 1.82 Tb, and the other is 476 Gb. My /home is 2 Tb, my /root is 25Gb, swap is 6 Gb.

Recently my /root lvm partition has been running out of space so I extended it by 25 Gb using the lvextend command. There were no errors and I went about my business. See lvdisplay output below.

~$ sudo lvdisplay
(truncated for brevity) 
--- Logical volume ---
  LV Path                /dev/computer/home
  LV Name                home
  VG Name                computer
  LV Size                2.00 TiB

--- Logical volume ---
  LV Path                /dev/computer/root
  LV Name                root
  VG Name                computer
  LV Size                50.00 GiB

  --- Logical volume ---
  LV Path                /dev/computer/swap
  LV Name                swap
  VG Name                computer
  LV Size                6.00 GiB 

However, it seems that ubuntu doesn't recognize that the lvm has been extended. I still get the warnings that my disk space will run out in the /root partition. You can see this in the Ubuntu Disk Usage Analyzer, which does not recognize the change.

Ubuntu Disk Usage Analyzer run as root

I was worried that I extended the lv without having enough free space, but the vgdisplay command tells me that there is 235 GiB of free space in this volume group.

My question: What's going on here and what can I do to fix this? Why does Ubuntu not recognize the extended logical volume? Is there something that I missed when extending the logical volume?

1

I think the main problem is that you've resized the volume (the container), but not the filesystem, so the OS can only see the filesystem that already exists, and what it thinks is the space available.

There are two ways of extending a logical volume that contains a filesystem, essentially:

  • Automatically, getting LVM to try to resize the filesystem in the process, i.e. using the lvresize command with the --resizefs flag. Depending on your filesystem, this may or may not work. In your case the full command would have been lvresize --resizefs --size +25G /dev/computer/root. It's too late to do this, so you can use the second method:

  • Manually, using separate lvextend and resize2fs commands. This should work for ext4 and other commonly used filesystems but may not work for some. I leave it up to you to find out whether you filesystem of choice can be extended. In this case, try running resize2fs /dev/computer/root, in order to grow the filesystem to the available space in its container.

There is a blog post covering how to do this here.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.