mySites.guru

Web Server disk space monitoring

The mySites.guru snapshot gives advance warning and alerts when your disk space (not virtual quota) is nearing full. Some web hosts hide this information.

Yesterday, at the request of a few users, we reinstated the mySites.guru disk space alerting into your mySites.guru accounts.

We have always retrieved the values from your sites for years, following our last attempt to display these values in your account failed several years ago, and it seems again the back lash on this feature is intense.

The thing is – we are just reporting the facts. Whether you like them or not, whether your web host likes the visibility of their physical service or not – they are facts. We are not making up the details.

When mySites.guru does a snapshot of your sites – twice a day – we use 2 well known and very old PHP functions to get 2 numbers. Both PHP functions have been a part of PHP since PHP 4.1.0!

The two PHP functions are here, (linked to the documentation)

disk_free_space

(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
disk_free_space — Returns available space on filesystem or disk partition

disk_total_space

(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
disk_total_space — Returns the total size of a filesystem or disk partition

Using these two numbers we calculate the amount of space in use, and the percentage used using the code:

 private function getDiskSpace()
    {
        if (! function_exists('disk_free_space') || ! function_exists('disk_total_space')) {
            return json_encode(array());
        }

        $data = array(
            'free'  => disk_free_space(JPATH_BASE),
            'total' => disk_total_space(JPATH_BASE),
        );

        $data['used'] = $data['total'] - $data['free'];

        $data['percentUsed'] = sprintf('%.2f', ($data['used'] / $data['total']) * 100);

        $data['free']  = $this->formatSize($data['free']);
        $data['total'] = $this->formatSize($data['total']);
        $data['used']  = $this->formatSize($data['used']);

        return json_encode($data);
    }

We don’t make up the values, apart from the USED and PERCENT USED – which we calculate using maths a teenager could do.

The two PHP functions above obtain information from the WEB HOST SERVER corresponding filesystem or disk partition which your site is on.

We store this data as a JSON string like:

{"free":"1.18 TB","total":"6 TB","used":"4.82 TB","percentUsed":"80.31"}

In mySites.guru this is then displayed as a WARNING if over 85% of the corresponding filesystem or disk partition is used (I.e the hard drive is filling up!) or a CRITICAL alert if 95% or more of the corresponding filesystem or disk partition is full.

Now a lot of users are getting warnings and critical alerts and moaning that mySites.guru is showing them the facts – then they contact their webhost who tell them that their ACCOUNT QUOTA (A totally different statistic – we cannot know or measure) is not at a warning/critical level – and then the mySites.guru subscriber is emailing me telling me mySites.guru is wrong.

We are not reporting the percentage of your ACCOUNT QUOTA – we are reporting the corresponding filesystem or disk partition of your web hosting account – the hard disk partition your files are on and which you SHARE with other sites on the same server. if that hits 100% then your server will be unstable, you will not be able to take backups, the hard disk partition will be full!!! EVEN IF YOU ARE ONLY AT 20% ACCOUNT QUOTA – and account quota is nothing more than a soft software limit – not a hard limit like the amount of data that will physically fit on a hard drive. Its the latter we are reporting on.

Believe whoever you trust more I guess. The PHP functions that the PHP project wrote and which have been part of the PHP project since PHP 4 – or your webhost.

My Webhost says there is 1.18TB free, so Im ok at 80%

er.. ok. Using the JSON string above as an example.

So ALL THE SITES on the server using the above example total 4.82TB of space consumed – all the sites are using the same partition/drive… so there must be 1000s of sites on this server all waiting for the hard drive, taking their turn to access the data, to read, to write to it, to load data from mysql… thats a lot of sites, but that could be ok on some web hosts.

So lets say another customer, with an unlimited quota now does a backup and takes 1.18Tb to back his backup, despite him being within his account quota – the hard disk is now full at 100% … and your site goes offline – possibly with a mysql errcode 28 (no free space) – or worse.

This is an extreme case, but we have seen a LOT of web hosts with over 95% utilisation of their corresponding filesystem or disk partition. I’ve seen some where there is only 1.02Gb of free disk space left!!! and thats on a major webhost!!

Here is a brief look at some of the worse data we have – would you be happy hosting on a webhost that only has 1.02Gb of free space left – what if your backup of your site needed more than that? or some other client on that server uploaded a movie or large backup??

disk space warnings!

I hate this warning – I don’t want this feature. Remove it!

Ok – Just turn off the reporting in your account.

In the left menu go to Notifications & Preferences, and then the Settings & Preferences Tab and toggle the “Show webhost disk space warnings” so its blue, and then stand up and walk around the office like an Ostrich…

mySites.guru account alerting preferences

Im a web host and I dont want you telling my customers about the free space not available on my server!

Tuff Titty.

All we are doing is calling standard PHP functions and telling our subscribers the values those functions give.

You could be pathetic and block those PHP functions, like you do other disable_function functions, but that is no way to run a professional webhost in 2023 is it?

My account quota is at 20% but you are telling me its 97%?!

We are not telling you anything – we are reporting the factual information about the corresponding filesystem or disk partition your website is running from – this is a physical limit of the corresponding filesystem or disk partition and not the soft limit called an account quota

Your account quota could be 1 trillion or 1 hundred – it makes no difference to this because we are not reporting your account quota – we are reporting the physical size of the corresponding filesystem or disk partition and its use.

Your account quota could even be very low in use but the server hard disk be nearly full, so if you were to attempt to upload files to max out your quota, you could find that was impossible because the physical limit of the corresponding filesystem or disk partition is exceeded first!

So why are the percentage use so high? is 90% normal?

Well we all know why they are so high – mass market web hosts make money by putting as many websites on the same hardware as possible to make the most profit possible for the hardware they have available. Its not uncommon – it seems – for mass market web hosts to run the corresponding filesystem or disk partition well above 80 or 90%

mySites.guru considers anything over 85% as a warning and anything over 95% as critical – but of course it’s relative. If you have a small 20Gb partition then 95% full would only leave you a few Gb left, but on a 10Tb partition, 95% would give you 0.5Tb (500Gb) free.

So what’s the bottom line here?

It’s up to you. Like everything in mySites.guru we just report the facts and give you amazing tools to investigate what we discover under the hood of your website. Use the information however you want, or don’t, disable the feature or don’t – its cool.

But don’t believe the lies of your web host. And don’t tell me mySites.guru is wrong, making things up or lying. I take personal offence.

Last updated on October 22nd, 2024