disk space mistery

I have a Linode with 20GB disk space. I also have another 4GB partition, but I'm not using it right now.

I ran out of disk space: this the output of df -h

Filesystem Size Used Avail Use% Mounted on

/dev/xvda 20G 19G 0 100% /

tmpfs 502M 0 502M 0% /lib/init/rw

udev 10M 116K 9.9M 2% /dev

tmpfs 502M 0 502M 0% /dev/shm

Then I ran ncdu to analyse which folders are taking all the space. But when I run it from the root folder /, it says that I'm using only 7.7GB in total (and the sum of the sizes of folders seems to be that).

Any idea where the other 12GB used could be hiding?

Is there any other tool I could use to locate the big folders?

Thanks

Bruno

3 Replies

Try this with and without -x and compare:

du -d 1 -c -h -x / | sort -h

If -d doesn't work you might need to specify the literal –max-depth.

Scenarios like this frequently mean a file was deleted while it was still open. Most commonly a debug log file in /tmp or log files in /var/log. When you delete a file in Linux (and most sane Unix-like systems) it doesn't free up the disk space until no one is using the file any more.

You can check for this with "lsof | grep deleted". If you see a line similar to

tin      21208      sweh    6u      REG      253,0       1768    851996 /tmp/tmpfMXfjFg (deleted)

then you need to check the "size". In this case the size is 1768 bytes, so this is a small file and not a problem (it just happens to be how "tin" works). If you find a program with a large deleted file then you need to stop that program. That should free up the file and let the OS reclaim the disk space.

In case of deleted-but-unclosed files, simply rebooting your server is also a valid solution.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct