0

Some processes seem to eat up the disk space on Linux (Ubuntu 16). I upgraded the disk of a laptop to 400 Gb one month ago. Now I have around 5 Gb of a free space. I spent many hours reading different posts on this forum and trying different commands. For example:

sudo du -x -d1 -h /var  | sort -hr

297G    /var
296G    /var/lib
207M    /var/cache
154M    /var/dell
118M    /var/log
59M /var/opt
18M /var/backups
17M /var/tmp
7,9M    /var/crash
92K /var/spool
20K /var/www
4,0K    /var/snap
4,0K    /var/metrics
4,0K    /var/mail
4,0K    /var/local

I tried to use du, find and Disk Usage Analyzer, but haven't found the issue:

find . -size +1G

find: ‘./.ssh/typos_ssh_keys/id_rsa.pub’: Permission denied
find: ‘./.ssh/typos_ssh_keys/id_rsa’: Permission denied
find: ‘./.local/share/Trash/expunged/3448374582/work/Catalina’: Permission denied
find: ‘./.local/share/Trash/expunged/3448374582/conf/Catalina’: Permission denied
find: ‘./.local/share/jupyter/runtime’: Permission denied
find: ‘./.dbus’: Permission denied
find: ‘./.cache/dconf’: Permission denied
find: ‘./.gvfs’: Permission denied

I was reading that there might be some logs that consume a lot of space. But I have not found such logs.

Any help will be highly appreciated?

  • Try with the command lsof | grep 'deleted' kill the process id which will lists – Praveen Kumar BS Dec 2 '17 at 20:05
  • 1
    Based on that du output, you should probably look deeper inside /var/lib – ilkkachu Dec 2 '17 at 20:12
  • Your /var/lib is huge. Normal size is about 100 times smaller. Use du -hs /var/lib/* | sort -hr | head -10 and so on to find the directory of interest. BTW, have you tried a simple sudo apt-get clean? – AlexP Dec 3 '17 at 16:50
0

Your /var/lib directory seems pretty big as the line 296G /var/lib tells. Your find . -size +1G however seems to be executed in the home directory and run from this directory upwards (so only big files in your home directory are shown). I would recommend looking in the /var/lib folder with this find command: find /var/lib -size +1G. or du -x -d1 -h /var/lib for further investigations.

0

Run your find starting at the root, under sudo, excluding special files, and directing errors to /dev/null. Probably something like this will get a lot closer to unearthing the large files:

sudo find / -type f -size +1G 2>/dev/null

You'll still get a few phony hits (like files under /proc, which show a size but don't take up any storage space), you could refine the search further to eliminate those as well.

At the user level, the "tracker" processes are really irritating, they index everything in your account running in the background, and it's tricky to get them not to run; sometimes the database generated can be large.

At the system level, systemd logging, if enabled, can take up a lot of space, as can audit files. /var/lib can contain tracking for the packaging system which sometimes grows surprisingly, mysql databases, and side effect of things you might be running - backing for docker goes here. /var/cache is probably package files, you can "apt-get autoclean" to remove older versions when newer ones have been installed, and "apt-get clean" to clean everything (based on your output, /var/cache isn't a problem for you).

There are TONS of resources on cleaning ubuntu systems, by the way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.