11

During the installation of Ubuntu Server 20.04.1 LTS I chose to use the entire disk as partition (default partitioning that's recommended for beginners, since I don't need any other partitions anyway.

Output of fdisk -l:

Device           Start        End    Sectors   Size Type
/dev/nvme0n1p1    2048    1050623    1048576   512M EFI System
/dev/nvme0n1p2 1050624    3147775    2097152     1G Linux filesystem
/dev/nvme0n1p3 3147776 2000406527 1997258752 952.4G Linux filesystem

But when I check with df -h, the biggest partition I have is around 200GB. Where are the rest roughly 750GB that are missing?

Output of df -h:

Filesystem                         Size  Used Avail Use% Mounted on
udev                                32G     0   32G   0% /dev
tmpfs                              6.3G  1.7M  6.3G   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv  196G   12G  175G   7% /
tmpfs                               32G     0   32G   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
tmpfs                               32G     0   32G   0% /sys/fs/cgroup
/dev/nvme0n1p2                     976M  104M  805M  12% /boot
/dev/nvme0n1p1                     511M  7.8M  504M   2% /boot/efi
/dev/loop1                          56M   56M     0 100% /snap/core18/1885
/dev/loop2                          71M   71M     0 100% /snap/lxd/16922
/dev/loop0                          55M   55M     0 100% /snap/core18/1880
/dev/loop3                          30M   30M     0 100% /snap/snapd/8542
/dev/loop4                          30M   30M     0 100% /snap/snapd/8790
/dev/loop5                          72M   72M     0 100% /snap/lxd/16099
overlay                            196G   12G  175G   7% /var/lib/docker/overlay2/33a73507dae561e19ce713e1a10bd44f68b6d231a7d27d7db5c2ae971dae834a/merged
tmpfs                              6.3G     0  6.3G   0% /run/user/1000

As asked, the output of lsblk:

NAME                      MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0                       7:0    0    55M  1 loop /snap/core18/1880
loop1                       7:1    0  55.3M  1 loop /snap/core18/1885
loop2                       7:2    0  70.6M  1 loop /snap/lxd/16922
loop3                       7:3    0  29.9M  1 loop /snap/snapd/8542
loop4                       7:4    0  29.9M  1 loop /snap/snapd/8790
loop5                       7:5    0  71.3M  1 loop /snap/lxd/16099
nvme0n1                   259:0    0 953.9G  0 disk 
├─nvme0n1p1               259:1    0   512M  0 part /boot/efi
├─nvme0n1p2               259:2    0     1G  0 part /boot
└─nvme0n1p3               259:3    0 952.4G  0 part 
  └─ubuntu--vg-ubuntu--lv 253:0    0   200G  0 lvm  /

Any help is appreciated, thanks in advance!

4
  • It is really weird that /dev/nvmen1p3 doesn't show up at all. can you run lsblk and df -h /
    – user1119410
    Aug 23 '20 at 17:26
  • df -h just gives the /dev/mapper/ubuntu--vg-ubuntu--lv part from above.
    – user1119603
    Aug 25 '20 at 10:20
  • I'm guessing here: The installer is set to leave drive space to allow for snapshots.
    – sudodus
    Oct 13 at 11:33
  • See also the discussion here: How is the size the LVM container decided?
    – sudodus
    Oct 13 at 16:45
13

I also used the default Ubuntu 20.04 install from ISO w/ lvm option selected. I had the same problem with the OS disk not occupying what I had allocated. Eddie's suggestion and the provided link did it for me. To summarize:

root@util:~# vgdisplay
<snip>
root@util:~# lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
<snip>
root@util:~# resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
<snip>

Before

root@util:~# df -h
Filesystem                         Size  Used Avail Use% Mounted on
udev                               3.9G     0  3.9G   0% /dev
tmpfs                              795M  1.1M  793M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv   98G  6.5G   86G   8% /
tmpfs                              3.9G     0  3.9G   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
tmpfs                              3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/xvda2                         976M  105M  805M  12% /boot
/dev/loop2                          56M   56M     0 100% /snap/core18/1944
/dev/loop0                          32M   32M     0 100% /snap/snapd/10707
/dev/loop1                         132M  132M     0 100% /snap/docker/796
/dev/loop3                          70M   70M     0 100% /snap/lxd/19188
/dev/loop4                          33M   33M     0 100% /snap/snapd/11588
/dev/loop5                          56M   56M     0 100% /snap/core18/1997
/dev/loop6                          71M   71M     0 100% /snap/lxd/19647
tmpfs                              795M     0  795M   0% /run/user/1000

After

root@util:~# df -h
Filesystem                         Size  Used Avail Use% Mounted on
udev                               3.9G     0  3.9G   0% /dev
tmpfs                              795M  1.1M  793M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv  196G  6.5G  180G   4% /
tmpfs                              3.9G     0  3.9G   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
tmpfs                              3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/xvda2                         976M  105M  805M  12% /boot
/dev/loop2                          56M   56M     0 100% /snap/core18/1944
/dev/loop0                          32M   32M     0 100% /snap/snapd/10707
/dev/loop1                         132M  132M     0 100% /snap/docker/796
/dev/loop3                          70M   70M     0 100% /snap/lxd/19188
/dev/loop4                          33M   33M     0 100% /snap/snapd/11588
/dev/loop5                          56M   56M     0 100% /snap/core18/1997
/dev/loop6                          71M   71M     0 100% /snap/lxd/19647
tmpfs                              795M     0  795M   0% /run/user/1000
1
  • Yes, this worked, lvextend alone didn't do anything
    – Madeo
    Jul 14 at 9:12
8

I had this problem also. The link below has instructions on how to extend the LVM partition to use all available space.

https://www.linuxtechi.com/extend-lvm-partitions/

Not mentioned in the above link is this command to use all remaining space rather than specifying a specific amount to add:

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

The installation is misleading because I specifically selected the option to use all available space, but not all available space was utilized.

1
  • Your lvextend command was all I needed for my new Ubuntu server install to use the entire disk.
    – M. K.
    Jul 29 at 21:15
3

Your root filesystem is on an LVM logical volume (LV) /dev/mapper/ubuntu--vg-ubuntu--lv (196 GB).

The LVM volume group (VG) that provides disk space for that LV probably has one single physical volume (PV), presumably that third partition on that SSD (/dev/nvme0n1p3 with 952.4G).

The VG probably still has a lot of disk space that you could use to make that LV bigger or to create another LV. It might be a disk space allocation strategy of the Ubuntu installer not to simply use all available disk space straight away for the root filesystem, giving you some leeway to decide what to do with the remaining disk space.

You didn't use the "-T" argument to the "df" command, so it doesn't tell the filesystem type; but most modern Linux filesystems have a tool to resize them. ext4 certainly supports that.

Here is a tutorial on the LVM tools: https://www.digitalocean.com/community/tutorials/how-to-use-lvm-to-manage-storage-devices-on-ubuntu-18-04

If you didn't explicitly select using LVM during installation, this might also be a result of choosing encryption; that is typically done via LVM.

HTH

1
  • I rechecked the installer and indeed "use lvm" is pre-ticked and then I might have been taken it. However, it's still a strange strategy from Canonical, doing it that way and calling it "use full partition", and mark it as recommended for beginners.
    – user1119603
    Aug 25 '20 at 10:23
0

Just run this command from the terminal:

sudo resize2fs -p /dev/mapper/ubuntu--vg-ubuntu--lv`

That did it for me. Then check it with:

df -h

Your Answer

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