AWS EC2 /tmp folder or “overflow” partition only 1mb

Had a strange problem while working with EC2. If you run out of space on a linux main partition it appears that instead of dying it uses it’s swan song to create a separate partition for /tmp – this presumably allows you to keep using the terminal and means the machine doesn’t grind to a complete halt.

Unfortunately on AWS when you snapshot the image and create a new machine (with a larger main partition) the /tmp folder remains. This is not a problem until something tries to use /tmp for something – hint, almost immediately when you start doing anything.

You verify this is the case by running

df -alh

which will show you the partitions and if you have run something and it failed (which is how I discovered the problem) then you should see that the “overflow” partition is mounted as /tmp and is full – or that it only has 1mb of space, both should be true if the situation above has happened to you.

To fix the problem remove the /tmp mount, using

sudo umount overflow

This may fail and if it does then you may need to use

sudo umount -l /tmp

The -l calls for lazy unmounting.

Posted in Uncategorized