1

Running df -h to see the disk usage I noticed that the sum of all the disks didn't add up to 1TB (the current SSD capacity):

'df -h' result

Searching commands to see the partitions I got sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL, and it shows that 200G are taken from a 930G block (... and the rest is lost?):

'sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL' result

While installing Ubuntu server (21.04) I left the default installation (maybe I had to change some numbers...). Is there anything I can do now?

2 Answers 2

8

It looks like your filesystem inside the LVM isn't taking up the available space.

example 200GB LVM utilising half the disk, which is the default when you install ubuntu server for example.

vgdisplay

VG Size               <199.00 GiB
Alloc PE / Size       25472 / 99.50 Gib
Free  PE / Size       25471 / <99.50 GiB


lsblk

└─sda3                      8:3    0   199G  0 part
  └─ubuntu--vg-ubuntu--lv 253:0    0  99.5G  0 lvm

Find the path name of your LVM:

lvdisplay

Mine is /dev/ubuntu-vg/ubuntu-lv

You can allocate all free space to the existing space with this: Obviosuly you should have a backup of your data before doing this.

lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv

After this completes check "vgdisplay" to verify the space has been allocated.

This is what it looks like after:

vgdisplay

  VG Size               <199.00 GiB
  Alloc PE / Size       50943 / <199.00 GiB
  Free  PE / Size       0 / 0

The file system is still going to be the same size though, it needs to be extended too. Mine is EXT4.

Inspect:

df -hT

Filesystem                        Type   Size  Used Avail Use%
/dev/mapper/ubuntu--vg-ubuntu--lv ext4    98G  5.1G   88G   6%

Run resize2fs to expand the ext4 filesystem to fill the VG

resize2fs /dev/ubuntu-vg/ubuntu-lv

This is what is looks like after:

df -hT

Filesystem                        Type   Size  Used Avail Use%
/dev/mapper/ubuntu--vg-ubuntu--lv ext4   196G  5.1G  182G   3% /

My 200GB LVM is now completely utilised.

3
  • It works like a charm! Thanks! Commented Sep 7, 2021 at 18:29
  • 1
    After 3 years this is still useful... Just a note: if you changed the disk size (because you're using a VM) you'll have to run first pvresize /dev/sda3 (assuming sda3 is where you have ubuntu), and then the other commands. (got from this reply) Commented Apr 23 at 14:38
  • In 2024 Jun this is still useful. I am running Ubuntu 20.04 inside a Virtualbox. Using lvextend 100% and resize2fs utilised my disk from 50% to 100%.
    – etoricky
    Commented Jun 16 at 9:54
0

Since you are using LVM2 (Logical Volume Manager 2) you have allocated 200 GB to set up the root partition mounted as /

You can still allocate more logical volumes from the 930 GB under LVM.

Nothing is lost, you haven't used it yet. You can create multiple volumes, for example, one you could mount as /home for your projects, /data or something else.

1
  • It allocates automatically on '/home'? Or how can it can be done? Commented Aug 7, 2021 at 3:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .