Skip to content

Instantly share code, notes, and snippets.

@thoroc
Last active March 30, 2020 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thoroc/f376ff2b1d684bd7b42ec75d424a3f47 to your computer and use it in GitHub Desktop.
Save thoroc/f376ff2b1d684bd7b42ec75d424a3f47 to your computer and use it in GitHub Desktop.
Help! /dev/mapper/fedora-root out of free space. How can I fix this?

Background

LVM has 3 layers:

  • PV: phisical volumes (Hard disks).
  • VG: volume groups, can spread across multiple PVs and can be expanded.
  • LV: logical volumes. These are the ones you map to mount points.

On top of you LV there is you file system.

Investigate space consumption

Run the following command to find the culprit: sudo du -h -d 1 / --exclude /proc.

This will list the mount point and the size taken on disk. Example output:

0	/sys
du: cannot access '/run/user/1657610655/gvfs': Permission denied
2.3M	/run
43M	/etc
32G	/var
14G	/usr
4.0K	/srv
1.1G	/opt
4.0K	/.cache
169G	/home
16K	/media
4.0K	/mnt
283M	/root
4.0K	/logs
4.0K	/index.yaml
du: cannot access '/tmp/.mount_jetbra0geTUT': Permission denied
1.2M	/tmp
16K	/lost+found
277M	/boot
20K	/dev
216G	/

Go through the dir list and run the same command passing the biggest directory path to investigate further.

Run df -h.

This will list mount points with size on disk (Allocated/Free/Taken). See example output bellow:

Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 7.7G     0  7.7G   0% /dev
tmpfs                    7.7G  663M  7.1G   9% /dev/shm
tmpfs                    7.7G  2.2M  7.7G   1% /run
tmpfs                    7.7G     0  7.7G   0% /sys/fs/cgroup
/dev/mapper/fedora-root   49G   33G   15G  70% /
tmpfs                    7.7G  1.3M  7.7G   1% /tmp
/dev/nvme0n1p2           976M  228M  681M  26% /boot
/dev/loop0               128K  128K     0 100% /var/lib/snapd/snap/hello-world/29
/dev/loop2               374M  374M     0 100% /var/lib/snapd/snap/anbox/186
/dev/loop1                92M   92M     0 100% /var/lib/snapd/snap/core/8689
/dev/nvme0n1p1           200M   51M  149M  26% /boot/efi
/dev/mapper/fedora-home  411G  169G  222G  44% /home
tmpfs                    1.6G   27M  1.6G   2% /run/user/1657610655

Do the same as above to confirm what is taking the most space on disk.

Finally run sudo lvs.

This will show the disk partition. That will give you an indication of where the space is lacking. Example output bellow:

  LV   VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  home fedora -wi-ao---- 417.89g                                                    
  root fedora -wi-ao----  50.00g                                                    
  swap fedora -wi-ao----   7.84g     

Clean up

In the current case, the culprit was with flatpak taking 32G out of the /root directory. Removing it and all software installed with it freed up enough space.

  • Remove unused flatpak packages: flatpak uninstall --unused
  • List software installed with flatpak: flatpak list
  • Remove each software: flatpak uninstall <Software-name>

Clean up the packages using DNF

Don't forget to run sudo dnf autoremove

source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment