ubuntu 18.04 - root partition full

erik_0000

Bronze Level Poster
my root filesystem is full. how can i fix the problem? i allocated 15G to root which i understand should be sufficient, i wonder if i have configured the partitions correctly. there might be a problem with the /snap directory.

here is the output of selected commands:

df -h /

Code:
erik@laptop:~$ df -h /
Filesystem  Size  Used Avail Use% Mounted on
/dev/nvme0n1p2   15G   13G  498M  97% /

df -h

Code:
erik@laptop:~$ df -h
Filesystem  Size  Used Avail Use% Mounted on
udev 16G 0   16G   0% /dev
tmpfs   3.2G  2.1M  3.2G   1% /run
/dev/nvme0n1p2   15G   13G  498M  97% /
tmpfs16G  4.0M   16G   1% /dev/shm
tmpfs   5.0M  4.0K  5.0M   1% /run/lock
tmpfs16G 0   16G   0% /sys/fs/cgroup
/dev/loop0   88M   88M 0 100% /snap/core/5662
/dev/loop1  173M  173M 0 100% /snap/spotify/21
/dev/loop2   15M   15M 0 100% /snap/gnome-logs/45
/dev/loop5  141M  141M 0 100% /snap/gnome-3-26-1604/74
/dev/loop7   13M   13M 0 100% /snap/gnome-characters/124
/dev/loop3   89M   89M 0 100% /snap/core/5897
/dev/loop4  141M  141M 0 100% /snap/gnome-3-26-1604/70
/dev/loop6   13M   13M 0 100% /snap/gnome-characters/139
/dev/loop8  174M  174M 0 100% /snap/spotify/24
/dev/loop10 130M  130M 0 100% /snap/postman/73
/dev/loop9  484M  484M 0 100% /snap/libreoffice/90
/dev/loop11  18M   18M 0 100% /snap/pdftk/9
/dev/loop12  15M   15M 0 100% /snap/gnome-logs/40
/dev/loop13 3.8M  3.8M 0 100% /snap/gnome-system-monitor/57
/dev/loop15 2.3M  2.3M 0 100% /snap/gnome-calculator/222
/dev/loop14  88M   88M 0 100% /snap/core/5742
/dev/loop16  13M   13M 0 100% /snap/gnome-characters/117
/dev/loop17 174M  174M 0 100% /snap/spotify/26
/dev/loop18 3.8M  3.8M 0 100% /snap/gnome-system-monitor/51
/dev/loop20 479M  479M 0 100% /snap/libreoffice/86
/dev/loop19  35M   35M 0 100% /snap/gtk-common-themes/808
   /dev/loop21 2.3M  2.3M 0 100% /snap/gnome-calculator/260
/dev/loop22  43M   43M 0 100% /snap/gtk-common-themes/701
/dev/loop23 3.8M  3.8M 0 100% /snap/gnome-system-monitor/54
/dev/loop24  35M   35M 0 100% /snap/gtk-common-themes/818
/dev/loop26 2.3M  2.3M 0 100% /snap/gnome-calculator/238
/dev/loop25 479M  479M 0 100% /snap/libreoffice/85
/dev/loop27  15M   15M 0 100% /snap/gnome-logs/43
/dev/sda1   1.8T  434G  1.3T  25% /home
/dev/nvme0n1p4  215G   61M  204G   1% /m2
/dev/nvme0n1p1  975M  6.1M  968M   1% /boot/efi
tmpfs   3.2G   16K  3.2G   1% /run/user/121
tmpfs   3.2G   36K  3.2G   1% /run/user/1000

sudo du -h --max-depth=1 / | grep '[0-9]G\>

Code:
erik@laptop:~$ sudo du -h --max-depth=1 / | grep '[0-9]G\>'
434G	/home
11G	/snap
4.2G	/usr
2.0G	/tmp
5.6G	/var
du: cannot access '/proc/7893/task/7893/fd/4': No such file or directory
du: cannot access '/proc/7893/task/7893/fdinfo/4': No such file or directory
du: cannot access '/proc/7893/fd/3': No such file or directory
du: cannot access '/proc/7893/fdinfo/3': No such file or directory
du: cannot access '/run/user/1000/gvfs': Permission denied
459G	/

dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n

Code:
erik@laptop:~$ dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n
[snip]
132042	libreoffice-core
134299	libgl1-mesa-dri
147486	libgl1-mesa-dri
161309	thunderbird
166969	linux-modules-extra-4.15.0-29-generic
166997	linux-modules-extra-4.15.0-34-generic
167001	linux-modules-extra-4.15.0-33-generic
167039	linux-modules-extra-4.15.0-39-generic
174305	firefox
179065	openjdk-11-jre-headless
194447	google-chrome-stable
236804	zoom
271127	linux-firmware

here are some things that i already tried, they didn't help:

Code:
sudo apt-get clean
sudo apt-get autoclean
sudo apt-get autoremove
sudo apt-get autoremove --purge
sudo apt-get remove --purge linux-image-X.X.XX-XX-generic # for old versions

sudo find / -xdev -name core -ls -o  -path "/lib*" -prune

erik@laptop:~$ dpkg -l "linux*{tools}*" |grep ^.i
dpkg-query: no packages found matching linux*{tools}*

i would be grateful for any assistance.
 

Stephen M

Author Level
Are you able to resize the partition with gparted. How many partitions do you have, I normally let Ubuntu partition for me, especially if doing a clean install, then it is just a small EFI partition with all the rest in the other.
 

erik_0000

Bronze Level Poster
many thanks for getting back to me.

i have a 256GB M2 drive on which i had installed boot, root, and swap, with leftover space mounted under /m2. then i have a 2TB drive on which i installed /home. snap filled up my /var directory.

i think the correct solution would have been to move /var to /home/var but i couldn't get that to work.

then i zapped swap and /m2, increased the size of root, and added back swap and /m2. but then i got errors relating to invalid sectors or corrupt disk, i can't remember exactly.

so then i stopped using the M2 drive altogether. i tried to shrink /home and to put boot, root, and swap at the end of the 2TB drive. but this got corrupted too. in the end i did a bare metal reinstall to the 2TB drive - boot, root, swap, home.
 

Stephen M

Author Level
Not sure if this is of any use.

I did an automatic install (letting Ubuntu partition the drive) on a 512 GB (actually 476.95 GiB) NVMe PCLe m2 SSD and that has only two partitions, the first is the fat32 EFI of 512 MiB with 7.1 used MiB, flagged "boot, esp" and with Mount Point /boot/efi, the rest is ext4 of 476.44 GiB with no flags and the mount point only marked as "/".
 

erik_0000

Bronze Level Poster
presumably you had a separate hard drive for your data and perhaps for your /home directory. when you did the automatic install, what did ubuntu do with that second drive?
 

Stephen M

Author Level
Yes, all my data my on another drive. Most cases I have put Ubuntu on to new machines but a couple of times it has been machines which had been used with another OS. I always make sure I have back ups of my other drives but as Ubuntu always asks which drive you want to install to it should not be a problem.
 

erik_0000

Bronze Level Poster
that makes sense. i probably could have done a default install both when i first set up the machine, and again later when i reinstalled after the M2 drive appeared to be corrupt. will try a default install next time, many thanks for the info.
 
Top