Score:0

Ubuntu not taking all disk space?

uz flag

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?

Score:1
ro flag

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.

Roger Miranda Perez avatar
uz flag
It works like a charm! Thanks!
Score:0
cn flag

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.

Roger Miranda Perez avatar
uz flag
It allocates automatically on '/home'? Or how can it can be done?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.