No space left on device error when there is still space

So I've seen this a couple of times and is usually related to your inodes. Basically every file gets an inode associated with it so there could be a large amount small files (think Linux Headers or log files) as small as 1 byte each and you'll end up running out of inodes long before you run out of disk.

Here's some quick commands to get you through this

# Check your inodes e.g. look for /dev/xvda1 
$ df -i

# Find folders with large amount of files in them
$ sudo find . -xdev -type f | cut -d "/" -f 2 | sort | uniq -c | sort -n

# If you're cleaning up you can also run the following to find large file
du -aBM 2>/dev/null | sort -nr | head -n 50 | more  

A large amount of files can usually be found in /usr/src which holds your headers. To clean them up you can

# Find your current version i.e. 3.13.0-123-generic - NOT THIS NUMBER
$uname -r

# List your packages
$ dpkg --list | grep linux-image

# One by one remove the old packages but NEVER removing yours. I'd actually make sure you have the last 3-5 revisions.
sudo apt-get purge linux-image-X.X.X-X-X  

Hopefully when you run df-i you have free'd up some inodes. If you are looking for other places to reduce the file count I would also check out /var/log/ and and the /tmp folder.