How to expand disk space

I have a 4 TB drive in my Ubuntu 24.04.3 LTS system. When I issue df -h command, it shows /dev/mapper/ubuntu–vg-ubuntu–lv, it shows Size as 49G, Used 7.2G, and Avail 40G. When I installed the system, I told it to use the entire disk for /. Why didn’t it use all the space?

If I boot to a Gparted Live USB stick, it shows 3.59 TB of unused space for the LV. If I try to write a 60 GB file to the / partition, it fills the /dev/mapper/… LVM up.

How can I use the unused portion of the / partition? I tried using the command lvextend -l +100%FREE /dev/mapper/ubuntu–vg-ubuntu–lv. That did not work, df -h shows 39G Avail. The Avail space went down by 1 TB even though the Used space didn’t go up.

How can I use the entire 3.59 TB of the disk?

To give us a better idea of the layout of your system storage, could you please share with us the output of the following four commands? And please show that output inside code tags.

df -Th
sudo pvs
sudo vgs
sudo lvs

Based on the command, you extended the size of ubuntu-lv without resizing the file system. Resizing the file system is done by including the option --resizefs (or -r) with lvextend.

The default install does not use all the space in the volume.

It leaves space so the user can expand / (root), add /home, or add other volumes.
If you have a 4TB drive using all of it for / may not be best. Many use separate volume(s) for data.

You need to extend the file system into the space before df will show the space. Can you please run the commands given by @aljames and we can advise

root@atc-firewall:~# df -Th
Filesystem                        Type      Size  Used Avail Use% Mounted on
tmpfs                             tmpfs     1.6G  4.5M  1.6G   1% /run
efivarfs                          efivarfs  128K   53K   71K  43% /sys/firmware/   efi/efivars
/dev/mapper/ubuntu--vg-ubuntu--lv ext4       49G  7.5G   39G  17% /
tmpfs                             tmpfs     7.7G     0  7.7G   0% /dev/shm
tmpfs                             tmpfs     5.0M     0  5.0M   0% /run/lock
/dev/sda2                         ext4      452M  101M  317M  25% /boot
/dev/sda1                         vfat       50M  6.2M   44M  13% /boot/efi
tmpfs                             tmpfs     1.6G   12K  1.6G   1% /run/user/1000

root@atc-firewall:~# pvs
  PV         VG        Fmt  Attr PSize  PFree
  /dev/sda3  ubuntu-vg lvm2 a--  <3.64t    0

root@atc-firewall:~# vgs
  VG        #PV #LV #SN Attr   VSize  VFree
  ubuntu-vg   1   1   0 wz--n- <3.64t    0

root@atc-firewall:~# lvs
  LV        VG        Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  ubuntu-lv ubuntu-vg -wi-ao---- <3.64t 

I read online and found more information. Based on what I read, I ran this command:

resize2fs /dev/mapper/ubuntu–vg-ubuntu–lv

It now shows the entire disk being available.

root@atc-firewall:~# df -h
Filesystem                         Size  Used Avail Use% Mounted on
tmpfs                              1.6G  4.5M  1.6G   1% /run
efivarfs                           128K   53K   71K  43% /sys/firmware/efi/efivars
/dev/mapper/ubuntu--vg-ubuntu--lv  3.6T  7.5G  3.5T   1% /
tmpfs                              7.7G     0  7.7G   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
/dev/sda2                          452M  101M  317M  25% /boot
/dev/sda1                           50M  6.2M   44M  13% /boot/efi
tmpfs                              1.6G   12K  1.6G   1% /run/user/1000

Problem solved.

Thanks for all the comments. Dennis_N, your comments about resizing was the solution. I didn’t know the resize could be part of the lvextend command.

3 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.