Score:0

Root drive out of space ? need to delete kernals

cn flag

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
...
David avatar
cn flag
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.
Artur Meinild avatar
vn flag
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`
cn flag
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
cn flag
Thanks for above, culprit is /var/lib/docker/overlay2 (23GB)
cn flag
`sudo docker system prune -a -f` ---> Total reclaimed space: 11.43GB
cn flag
@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 :)
CatMan avatar
fr flag
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?
Score:0
cn flag

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.

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.