PHP ERROR - Message: fopen(/var/lib/php/sessions/..): failed to open stream: No space left on device

October 23, 2019 127 views
DigitalOcean PHP Frameworks

Hi,

I have gone through the community posts and still I face this Message: fopen(/var/lib/php/sessions/ci_sessiond0v4i5qeugpm0t9qodulbij3aoabot4b): failed to open stream: No space left on device issue persists.

Output for *df -h***

[Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 798M 636K 798M 1% /run
/dev/vda1 155G 82G 74G 53% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/vda15 105M 3.6M 101M 4% /boot/efi
tmpfs 798M 0 798M 0% /run/user/0](http://)

I still have space available, so that is not the issue.
I have also gone through this post .

This error comes frequently, if I refresh then it might work for sometime. Then the same issue pops up again. Please help me resolve this, as this is affecting the user experience a lot.

Framework used - Codeigniter

Regards

2 Answers

Hello,

It sounds like that your Inodes might be full. Try running the df command but with -i argument:

df -i

This usually happens when you have a huge number of really small files, that way you would still have space available but no available inodes.

Let me know how it goes!
Regards,
Bobby

  • Thank you for the reply, below is the output

    Filesystem       Inodes    IUsed   IFree IUse% Mounted on
    udev            1017752      384 1017368    1% /dev
    tmpfs           1021013      572 1020441    1% /run
    /dev/vda1      20643840 17057361 3586479   83% /
    tmpfs           1021013        1 1021012    1% /dev/shm
    tmpfs           1021013        4 1021009    1% /run/lock
    tmpfs           1021013       18 1020995    1% /sys/fs/cgroup
    /dev/vda15            0        0       0     - /boot/efi
    tmpfs           1021013       10 1021003    1% /run/user/0
    

    Sorry if I am asking to many questions, I am still in a learning phase. That means “/dev/vda1” is used 83%. Is that an issue ?

    • Hello,

      Yes indeed it looks like that the /dev/vda1 filesystem is at 83%, which is quite high. I would recommend finding the folder that is using most of the inodes and clear it up. My recommendation is to try and keep it at around 70% at most in order to prevent the issue that you are experiencing.

      It is most likely your application that is generation some session files.

      Maybe you could try using something like Redis or Memcache to store your sessions in as well.

      Hope that this helps!
      Regards,
      Bobby

Have another answer? Share your knowledge.