Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon EC2 micro instance - ran out of space? [closed]

df -h shows that only 71% of space used:

root@ip-xxx-xxx-xxx-xxx:/home/myuser# df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs          7.9G  5.3G  2.2G  71% /
udev             10M     0   10M   0% /dev
tmpfs            60M   88K   60M   1% /run
/dev/xvda1      7.9G  5.3G  2.2G  71% /
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           120M     0  120M   0% /run/shm

However nothing can create a file anymore, even MC does not start

#mc
Cannot create temporary directory /tmp/mc-root: No space left on device (28)

Php can not create files

PHP Warning:  fopen(/home/.../file.json): failed to open stream: No space 
left on device in /webdev/www/..../my.php on line 10

What could it be?

I use Debian 7 on Micro instance.

like image 450
Pavel Avatar asked Jun 12 '14 01:06

Pavel


1 Answers

df -h shows you disk free space in human readable format. But this sounds like an inode table issue which you can check via df -i. For example, here is my inode usage on my own Amazon ECS micro instance running Ubuntu 12.04:

Filesystem     Inodes  IUsed  IFree IUse% Mounted on
/dev/xvda1     524288 116113 408175   23% /
udev            73475    379  73096    1% /dev
tmpfs           75540    254  75286    1% /run
none            75540      5  75535    1% /run/lock
none            75540      1  75539    1% /run/shm

Depending on the output, I bet your inode table is filled to the brim. The inode table logs each individual file data. Not just how much space. Meaning you might have 71% in use, but that 71% can be filled with thousands of files. So if you have tons of small files, you might still technically have free space, but the inode table is full so you have to clear that out to get your system fully functional again.

Not too clear on the best way to clear this up, but if you know of a directory that has tons of files you can toss away right away, I would recommend removing them first. For what it’s worth, this question & answer thread looks like it has some decent ideas.

like image 89
Giacomo1968 Avatar answered Sep 27 '22 16:09

Giacomo1968