Linux

How To Deal with SessionHandler::Read() No Space Left on Ubuntu

A Magento site went down with a bunch of error messages saying that:

Warning: SessionHandler::Read() No space left on device

First thought, ok, that’s easy. I can just log in and clean up some cache data or log files and everything will just be fine after that.

Turns out, after running df -h, there are still tons of spaces left on the server.

So, what’s the deal?

Here come the inodes.

The inode (index node) is a data structure in a Unix-style file system that describes a file-system object such as a file or a directory. Each inode stores the attributes and disk block location(s) of the object’s data. File-system object attributes may include metadata (times of last change, access, modification), as well as owner and permission data.

Basically, if you have a lot of big files, you will most likely run out of space, the physical real space. But if you have a lot of tiny small files, you will likely run out of inodes. When that happens, you will get the out-of-space message even though there is still a lot of free space left on your drive.

To find out the number of inodes,

df --inodes or df -i

Next step, let’s identify which file or folder consumes the inodes.

find / -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -n

Once find out, dive into that folder and clean things up. In my case, it’s the folder /var/lib/php/sessions that consumed all the inodes.

sudo rm -rf /var/lib/php/sessions/
sudo mkdir /var/lib/php/sessions/ && sudo chmod 1733 /var/lib/php/sessions/
edge

Share
Published by
edge
Tags: inodes

Recent Posts

Disable Copilot on Windows 11 via Group Policy GPO

If using Copilot right from the Taskbar isn't your thing, you should disable it. Even…

8 months ago

Setting Default Fonts in Word, Excel, Outlook, and PowerPoint via Group Policy

In an environment where standardizing things does matter, setting default fonts in Microsoft Office apps…

9 months ago

Wake-On-LAN (WOL) with Windows and PowerShell

Wake-On-LAN is a networking standard that lets you wake up a computer from either a…

9 months ago

How To Remove Restrictions Set in A Password-Protected PDF File

First of all, this is not to bypass a PDF file that requires a password…

9 months ago

How To Move My Outlook Navigation Bar Back From Left Back To the Bottom

Microsoft has been lurking about the idea of placing the Outlook navigation bar to the…

2 years ago

Headset with Microphone Echoing My Own Voice on Windows, What To Do?

One colleague came up to me the other day asking me to take look at…

2 years ago