0

linux disk full – lsof does not help

Did you ever experience a full disk on (x)ubuntu? I did recently and wondered and recalled like many others about differences between du and df command. Almost all of these answers did not help me unfortunately.

Full disk issue analysis

Most of the answers refer to lsof because processes may write to unlinked files that seems to be deleted.

However I was on my xubuntu laptop and did restart the operating system already, hence there were no unlinked files processes may still write to.
Doing more search on the web I found answers that propose to find big directories and free up those:

  • sudo du -s ./* | sort -n
  • sudo du -shx ./* | sort -hr

That does not help me either and here is why:

Solution

I had to become root (e.g. sudo su –) before runnning du.
Running du as none root does not show you all the folders you experience as root.
In my case:

root@....:/# du -s ./* | sort -n

returned

...
83613626 ./media
...

So that guy eat up my disk! This was caused by myself not properly unmounting disks after restoring files from trash – sigh.

https://superuser.com/questions/738690/deleting-files-but-disk-space-is-still-full/738887#738887 was really great finding the root cause of my full disk.

In short:

If you experience a situation like:

  • a full disk on linux
  • df and du return different results

consider to run

  • du as root            e.g. du -s ./* | sort -n

next to

  • df -i                       to check inodes
  • lsof -nP +L1        to find open unlinked files

to find the root cause of the full disk.

Lothar Schulz

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.