1

I have a Ubuntu Server 20.04 running in a virtual machine. It started complaining that there was no enough space on "/" to run software update, so I followed this wonderful advice: Ubuntu Server 18.04 LVM out of space with improper default partitioning and raised the "/" size from 110 GiB to 173 GiB. Now, I am able to complete the update.

Still, by looking at $df -h output, it seems that I could get some more space freed up from other parts, but I am not sure how and if it is possible. I will appreciate any help!

Filesystem  Size    Used    Avail   Use%    Mounted_on
udev    3.9G    0   3.9G    0   /dev
tmpfs   796M    2.0M    794M    0.01    /run
/dev/mapper/ubuntu--vg-ubuntu--lv   170G    104G    59G     0.64    /
tmpfs   3.9G    16K     3.9G    0.01    /dev/shm
tmpfs   5.0M    0   5.0M    0   /run/lock
tmpfs   3.9G    0   3.9G    0   /sys/fs/cgroup
/dev/sda2   974M    215M    692M    0.24    /boot
/dev/mapper/ubuntu--vg-lv--1    49G     7.5G    39G     0.17    /var
/dev/loop0  9.0M    9.0M    0   1   /snap/canonical-livepatch/132
/dev/loop2  115M    115M    0   1   /snap/core/13886
/dev/loop1  9.0M    9.0M    0   1   /snap/canonical-livepatch/146
/dev/loop5  56M     56M     0   1   /snap/core18/2620
/dev/loop7  64M     64M     0   1   /snap/core20/1634
/dev/loop6  64M     64M     0   1   /snap/core20/1695
/dev/loop9  68M     68M     0   1   /snap/lxd/22753
/dev/loop10     48M     48M     0   1   /snap/snapd/17336
tmpfs   796M    32K     796M    0.01    /run/user/1000
tmpfs   796M    4.0K    796M    0.01    /run/user/130
tmpfs   796M    40K     796M    0.01    /run/user/128
/dev/loop12     50M     50M     0   1   /snap/snapd/17576
/dev/loop11     115M    115M    0   1   /snap/core/14056
/dev/loop3  56M     56M     0   1   /snap/core18/2632
/dev/loop4  92M     92M     0   1   /snap/lxd/23991
mcnubb
  • 11

1 Answers1

0

A quick win would be to set the reserved percentage for root of the drives to 0%.

sudo tune2fs /dev/sda -m 0

This will free up diskspace that is reserved for root at all times.

Or add diskspace to the VM or with hardware and expand the logical volume:

Use the set of lvm commands for that after creating the new partition.

First create the physical volume (pvcreate) Extend volume group (vgextend) Extend the logical volume (lvextend)

resize the filesystem.

As root:

fdisk /dev/sda (follow steps to create /dev/sda4 partition)
pvcreate /dev/sda4
vgextend ubuntu-vg /dev/sda4
lvextend -L+4.9G /dev/mapper/ubuntu--vg-ubuntu--lv
resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv