In the realm of self-hosting websites, enthusiasts often turn to Raspberry Pi as a cost-effective and versatile solution.
While it empowers you to take control of your web hosting, it also poses challenges, one of which is dealing with critically low disk availability.
In this article, we’ll dive deep into resolving this issue to ensure your self-hosting website remains accessible and functional.
1. STEP: Evaluate the problem
WordPress provides information about your website’s health status within the “Tools” and “Site-health” menu section.

You will find the message from WordPress, that the health of the site “Should be improved”

The explanation behind this is the insufficient space on your hard drive, hindering the update process. WordPress will also notify you that “The available disk space is critically low, with less than 20Mb available.”
This issue is simply a minor coding error, which we will address and resolve today.
2. step: correcting class-wp-site-health.php
To make changes to the PHP file, we must first locate it. You can locate it under the name “class-wp-site-health.php.”
SSH in your raspberry pi.
Give your password for your ssh and you are in your Pi.
You can now navigate to the WordPress “Config,” “wp-admin,” and “includes” locations using the “cd” command.

You can use the “nano” command to access and open the “class-wp-site-health.php” file.

To search for the problematic section, press Ctrl-W and enter “available_space” as shown below.


It will take you to the ‘available_space’ section and then proceed to code line 1947.
Make the necessary modifications to the following section.
Change this:
$available_space = false !== $available_space ? (int) $available_space : 0;
To this:
$available_space = false !== $available_space ? $available_space : 0;


“The cast (int) $available_space causes the issue, the issue is caused if you have to much free space. Then this cast returns a negative number. In my case:
$available_space => 42632790016
(int) $available_space => -316882944″Source by henryjanssen –> https://wordpress.org/support/topic/available-disk-space-is-critically-low-less-than-20-mb-available-proceed-with/
Save the .php file by pressing Ctrl-X, then press “Y” and enter to save it to the same name.


3. step: check the site-health in your wp-admin.
By following these steps, you should resolve the issue, and your self-hosting website should now display a “Good” indication.

I hope this was helpful to you. If it was, please consider subscribing to the blog.
Best wishes,
Márk from Why-not Theory