0

My root drive (32GB) has run out of space, on ubuntu server 18.04lts. I only run docker and nothing else, and the docker data directory is on a different drive. I tried all the usual tricks to try and free data and i'm still sitting on 100%. I'm wondering if it's too many kernals, but I don't really fully understand about deleting unused ones. I have tried

$ sudo purge-old-kernels
0 upgraded, 0 newly installed, 0 to remove and 110 not upgraded.
$ sudo apt-get --purge autoremove
0 upgraded, 0 newly installed, 0 to remove and 110 not upgraded.

If I list all the kernals I get the following output: https://pastebin.com/9Xb3BU29

Do you think the kernals are taking up all the space?

Here is the output for sudo df -h: https://pastebin.com/0Ai8UG2c

(note /dev/sdi3 is the root drive that ubuntu runs on)


mike@server:/$ sudo du / -h -x --max-depth=1 2> /dev/null | sort -hr
31G     /
27G     /var
2.4G    /usr
...

sudo du /var/lib/docker -h -x --max-depth=1 2> /dev/null | sort -hr
26G     /var/lib/docker
23G     /var/lib/docker/overlay2
1.9G    /var/lib/docker/containers
1.2G    /var/lib/docker/volumes
...
muru
  • 197,895
  • 55
  • 485
  • 740
  • Deleting kernels will not free up much space. 32 gigs is pretty small as the OS alone recommends 25 gig. You need more space and I also see in your question this !and 110 not upgraded.! The system regularly deletes old unused kernels. – David Sep 30 '21 at 07:07
  • It's not kernels. Please run this command and post the result in your question: sudo du / -h --max-depth=1 2> /dev/null | sort -hr – Artur Meinild Sep 30 '21 at 07:07
  • 10Gb is enough for a desktop. For servers too if you move website (apache) and databases (mysql) to another partition. @Kiwijunglist do check /var/log/ for large log files 1st before you run Artur's command. That is the likely culprit: errors logged that went unnoticed. If so: do note that server maintenance means checking /var/log/ every so often ;) And please do not delete kernels. If you mess that up the server is going to have problems booting next time... you don't want that. Stay as much with stock Ubuntu as possible on a server. It won't fix your space problem either – Rinzwind Sep 30 '21 at 07:13
  • 1
    Thanks for above, culprit is /var/lib/docker/overlay2 (23GB) – Kiwijunglist Sep 30 '21 at 07:21
  • 1
    sudo docker system prune -a -f ---> Total reclaimed space: 11.43GB – Kiwijunglist Sep 30 '21 at 07:22
  • @Kiwijunglist you could put /var/ on its own partition with a large amount of space if you want. Otherwise put this command in /etc/crontab and let it run once a month or something like that :) and do post it as an answer! others will run into this too :) – Rinzwind Sep 30 '21 at 10:03
  • Great, can some of the contributors or maybe the OP him/herself please add is as an answer and select it as chose answer, so this question can be marked closed? – CatMan Oct 01 '21 at 16:57

1 Answers1

0

Run this command to find large folders that come off the root drive. sudo du / -h -x --max-depth=1 2> /dev/null | sort -hr (note the -x keeps the search limited to the one physical drive rather than going into mounted folders/other partitions)

Then I ran

sudo du /var/lib -h -x --max-depth=1 2> /dev/null | sort -hr

I found /var/lib/docker was the culprit.

Thanks for the help from the users above.