Friday, September 20, 2013

Disk space not used, but not free. Where did it go...

I recently pulled out almost all of my hair, searching for lost disk space on a Ubuntu box.

"df" showed that almost all space on disk was used, but i was not able for find the files taking up all the space. Of course I went through all the usual suspects (, but in the end cause was very simple and yet not obvious.
Side story; the box runs a installation of MySQL that had been mangled when trying to import a database from another box. The MySQL files had been deleted, but I forgot to shutdown the MySQL daemon. So all files used by MySQL was still held by MySQL. This led to disk space being used, but not found when searching for files. the trick to discover the used space was the following:

lsof | grep "deleted"

I know it is a obvious error, but I use a few hours to find this.So heres the tip for you.

No comments: