Score:0

df probably shows possibly wrong total

cn flag

I have recently spun up a new Ubuntu VM with Docker using KVM:

virt-install \
  --bridge=br0 \
  --name "${worker_name}" \
  --ram 4096 \
  --disk path=/var/lib/libvirt/images/"${worker_name}".qcow2,size=150 \
  --vcpus 2 \
  --cdrom /var/lib/libvirt/isos/ubuntu-20.04.2-live-server-amd64.iso \
  --autostart

As you can see I have set the size of the disk to 150GB, however when I run df -h --total I see the space is less:

Filesystem                         Size  Used Avail Use% Mounted on
udev                               1.9G     0  1.9G   0% /dev
tmpfs                              394M  1.2M  393M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv   73G   12G   58G  17% /
tmpfs                              2.0G     0  2.0G   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
tmpfs                              2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/sda2                          976M  106M  804M  12% /boot
/dev/loop0                          56M   56M     0 100% /snap/core18/1944
/dev/loop1                          70M   70M     0 100% /snap/lxd/19188
/dev/loop2                          32M   32M     0 100% /snap/snapd/10707
/dev/loop3                          33M   33M     0 100% /snap/snapd/12704
/dev/loop4                          56M   56M     0 100% /snap/core18/2074
/dev/loop5                          71M   71M     0 100% /snap/lxd/21029
tmpfs                              394M     0  394M   0% /run/user/1000
total                               81G   24G   50G  17% -

When I pull some images the space double:

Filesystem                         Size  Used Avail Use% Mounted on
udev                               1.9G     0  1.9G   0% /dev
tmpfs                              394M  1.2M  393M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv   73G   12G   58G  17% /
tmpfs                              2.0G     0  2.0G   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
tmpfs                              2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/sda2                          976M  106M  804M  12% /boot
/dev/loop0                          56M   56M     0 100% /snap/core18/1944
/dev/loop1                          70M   70M     0 100% /snap/lxd/19188
/dev/loop2                          32M   32M     0 100% /snap/snapd/10707
overlay                             73G   12G   58G  17% /var/lib/docker/overlay2/ebbada787a53d478e22925d4996e39ad510a3abe2c8e8d814021cb4f774291dc/merged
/dev/loop3                          33M   33M     0 100% /snap/snapd/12704
/dev/loop4                          56M   56M     0 100% /snap/core18/2074
/dev/loop5                          71M   71M     0 100% /snap/lxd/21029
tmpfs                              394M     0  394M   0% /run/user/1000
total                              154G   24G  123G  17% -

And now it appears correct, but it seems like the docker overlay2 is a "mirror" of the LVM volume ubuntu--lv, is this correct or df just display a wrong total? In that cause I would run:

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

I am really a newbie when it comes to disk and partition, could someone please highlight what is going on here?

Thanks

System info

Distributor ID: Ubuntu Server
Description:    Ubuntu 20.04.2 LTS
Release:        20.04
Codename:       focal

 LVM version:     2.03.07(2) (2019-11-30)
  Library version: 1.02.167 (2019-11-30)
  Driver version:  4.41.0
  Configuration:   ./configure --build=x86_64-linux-gnu --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/share/man --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libdir=${prefix}/lib/x86_64-linux-gnu --libexecdir=${prefix}/lib/x86_64-linux-gnu --runstatedir=/run --disable-maintainer-mode --disable-dependency-tracking --exec-prefix= --bindir=/bin --libdir=/lib/x86_64-linux-gnu --sbindir=/sbin --with-usrlibdir=/usr/lib/x86_64-linux-gnu --with-optimisation=-O2 --with-cache=internal --with-device-uid=0 --with-device-gid=6 --with-device-mode=0660 --with-default-pid-dir=/run --with-default-run-dir=/run/lvm --with-default-locking-dir=/run/lock/lvm --with-thin=internal --with-thin-check=/usr/sbin/thin_check --with-thin-dump=/usr/sbin/thin_dump --with-thin-repair=/usr/sbin/thin_repair --enable-applib --enable-blkid_wiping --enable-cmdlib --enable-dmeventd --enable-dbus-service --enable-lvmlockd-dlm --enable-lvmlockd-sanlock --enable-lvmpolld --enable-notify-dbus --enable-pkgconfig --enable-readline --enable-udev_rules --enable-udev_sync

df (GNU coreutils) 8.30
guiverc avatar
cn flag
If it's Ubuntu 20.04 LTS, why do you indicate it's a 20 release (ie. *snap* only Ubuntu Core 20 type of product). Ubuntu has had both *year* and the more common *year.month* products since 2016 - and they are different products. Please be precise (both are designed for server & cloud/VM use)
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.