Linux disk full errors but disk has space

Today I had a customer reporting a wordpress error when uploading images. "Missing a temporary folder"

Checked file permissions on /tmp – they were fine.

But is /tmp the location of the temporary folder for the site? Went to add a new file for a quick php_info(); and got a "disk space full error". Ahhh, that explains it.

Run "df -h" to check diskspace and the drives were between 0% – 18% full, loads of space.

But knowing the way that linux file systems work having encountered this issue before I know the problem and the solution.

Inodes

Inodes are a finite resource on most linux file systems which limit the total maximum number of files.

They work in a similar way to an index or table of contents at the start of a book.

Both the book and the index were created at the same time, completely empty but with a suitable number of index entries (inodes) for the pages (files) in the book.

On a normal system you run out of disk space well before you run out of inodes – this server had 38GB diskspace and 4.9 million inodes meaning an average file size of 7.7KB would fill disk and inodes perfectly.

But if you get a server with an unusually large number of extremely small files the inodes limit can be an issue.

Increasing inode limits will normally require reformatting the disk so not good for a production machine – so the fix is to delete files.