Ubuntu – No Disk Space Left While There is a Space

14.04diskdisk-usage

I have an DigitalOcean server. I got the basic one for testing.
I started to get these two errors;

Unknown: open(/var/lib/php5/sess_heg8br5i1ye4skuuq1gsg7dp40, O_RDWR) failed: No space left on device (28)

PDOException: SQLSTATE[HY000]: General error: 1 Can't create/write to file '/tmp/#sql_417_0.MYI' (Errcode: 28)

When I use df -Th I get the following results and it seems I got 5.9G more space to use.

Filesystem                Type      Size  Used Avail Use% Mounted on
udev                      devtmpfs  235M  4,0K  235M   1% /dev
tmpfs                     tmpfs      50M  344K   49M   1% /run
/dev/disk/by-label/DOROOT ext4       20G   13G  5,9G  69% /
none                      tmpfs     4,0K     0  4,0K   0% /sys/fs/cgroup
none                      tmpfs     5,0M     0  5,0M   0% /run/lock
none                      tmpfs     246M     0  246M   0% /run/shm
none                      tmpfs     100M     0  100M   0% /run/user

I'm no server admin so I really don't get why I can't access 5.9G partition.

I don't know if this is related but I guess I should mention I have a pictures directory where I keep more than 1 million image files. I hear this is very bad idea to keep. I'm planning to organize them into directories so there would be a lot less files under a directory. Would this effect some how on tmp space not being enough?

Best Answer

I don't know if this is related but I guess I should mention I have a pictures directory where I keep more than 1 million image files.

That is your problem. Every directory and file also consume 1 inode so that wont fix your problem.

df -i

shows you inodes (check for your own system how many you have free) Example:

Filesystem       Inodes  IUsed    IFree IUse% Mounted on
udev            1518973    590  1518383    1% /dev
tmpfs           1523785    843  1522942    1% /run
/dev/sda2       3049648 190226  2859422    7% /
tmpfs           1523785     15  1523770    1% /dev/shm
tmpfs           1523785      3  1523782    1% /run/lock
tmpfs           1523785     18  1523767    1% /sys/fs/cgroup
/dev/sda1             0      0        0     - /boot/efi
/dev/sda5       2256576  12935  2243641    1% /home
/dev/sdb1      61054976   1638 61053338    1% /discworld
cgmfs           1523785     14  1523771    1% /run/cgmanager/fs
tmpfs           1523785     33  1523752    1% /run/user/1000

Running out of them also is a "no space left on device".

You set the amount of inodes during creation of the partition so it is not easy to fix when the disk contains so many files (you'd need to back them up, recreate the file system and then restore them).

You are probably better off creating a 2nd, 3rd, 4th partition and store those files on those partitions.

Related Question