7 Easy Ways to Check Disk Usage in WordPress
By Brian Jackson, Updated: July 28, 2017
There is no such thing as “unlimited” disk space or bandwidth when it comes to web hosting. Shared WordPress hosts typically advertise this but still have limits in place behind the scenes if you read their terms of service (TOS). Over time your WordPress site can grow pretty fast, and eventually, you might hit your limits, whether it be 5 GB or 20 GB. And if you hit the magical “unlimited” quota, this is usually an email from your host saying you’re abusing their TOS. So today we will share with you a few ways to check disk usage in WordPress so you can clean up your sites. There are a lot of server commands that allow you to do this, but we are going to focus on some easy ways for those that may not be comfortable using SSH or aren’t as tech savvy.
Calculating Disk Usage in WordPress
Before we dive into how to check your disk usage, it is important to understand that what we are referring to. In WordPress, disk usage is typically composed of two things; your files and database. Combined these make up your total disk usage that is being used on your server, that take up your allocated resources.
Files on the Server
WordPress files that take up disk space include things such as:
- Images and video uploaded to your media library (typically in wp-content/uploads/)
- Theme and plugin files (PHP, CSS, JS) (typically in wp-content/themes/ and wp-content/plugins/)
- WordPress core (your main WordPress installation files) (typically in the root or public_html folder)
- Any files uploaded via FTP (such as custom web fonts, libraries, etc.)
MySQL Database File
Your WordPress MySQL database file stores all of the information on your WordPress site, such as post data, page data, meta information, plugin settings, login information, etc.
7 Ways to Calculate Disk Usage
A lot of managed WordPress hosts don’t use cPanel and have their own built-in reporting to view resource usage for your site. And these might not always give you the data you need. Providers typically focus on an overview and less on the granular level. Although some do have some granular reporting via CSV. So this is where the following methods below can come in handy for getting more information about disk usage, for both your files and database.
- Check Disk Usage With WordPress Plugins
- Check Disk Usage and Database Size in cPanel
- Check Database Size With WordPress Plugin
- Check Database Size With phpMyAdmin
- Ask Your Hosting Provider
- Dive Into Disk Usage Locally
- Check Disk Usage via SSH
There are two handy WordPress plugins which can help you quickly see more about the size of your WordPress site and what files and media are taking up the most space. However, we don’t recommend leaving them permanently installed. Plugins like this can tend to slow down the backend dashboard and sometimes not even work due to PHP limits on your server. Get the info you need and then at least deactivate them.
The first is the free Disk Usage Sunburst plugin from the team over at RaidBoxes. This plugin shows all the files of your WordPress install in a sunburst chart.
It currently has over 1,000 active installs with a 5 out of 5-star rating. You can download it from the WordPress repository or by searching for it within your WordPress dashboard under “Add New” plugins. Once installed click into “Disk Usage” under tools.
You will then see the sunburst chart and can hover over a large area to quickly spot which folders are taking up the most space. Not to our surprise, in our example, it is the uploads folder, where all of our media is stored. You can then click on each area/folder to go a level deeper.
We can then see that it is the 2016 folder which is taking up the most space.
And in fact, you can keep going deeper, all the way down to your files in fact. (although the UI is not that great when you go all the way down since it is pretty hard to see) In our installation, we determined that there were a bunch of images in the 04 April folder from 2016 that were never optimized. So all in all, it can be a great troubleshooting plugin to quickly identify large files and folders taking up space on your server.
The second is the free My Simple Space plugin from Michael Mann. This plugin enables a simple widget on your WordPress admin dashboard.
It currently has over 700 active installs with a 4.5 out of 5-star rating. You can download it from the WordPress repository or by searching for it within your WordPress dashboard under “Add New” plugins. After installing it simply activates a widget in your WordPress admin dashboard which shows you details on your WordPress site, such as how big your database is, your entire site, and also a brief overview of your other folders.
While you can’t get any granular data with this plugin, it could help you spot a quick issue.
If your host uses cPanel, you can easily see an overview of your total disk usage on the sidebar.
You can also dive into the disk usage reports for more granular data. Simply click on “Disk Usage” under Files.
At the bottom of the screen, you can then drill down into the folders and sort them by disk usage.
You can also view your MySQL database size. Simply click on “MySQL Databases” under Databases.
Under current databases, it will show you the total size of the database.
Perhaps you are wanting to see more granular data on your WordPress database size? For example, knowing just the total size isn’t very helpful if you are trying to determine what is taking up space in the database. That is where the free WP-Optimize plugin can come in handy. Essentially it is a tool to analyze and clean up your database.
It currently has over 600,000 active installs with an impressive 5 out of 5-star rating. You can download it from the WordPress repository or by searching for it within your WordPress dashboard under “Add New” plugins. Once installed you can click on WP-Optimize in your WordPress dashboard and then click on the “Table information” tab. There are a lot of optimizations you can do with this plugin but we won’t be going into those today, we are concerned with spotting what is using up the most space in your database.
Typically database tables will be named something similar to the name of the plugin they are used by. Right off the bat, we were able to spot “database waste.” For example, the “ab_press_optimizer” tables are used by the AB Press Optimizer plugin which was no longer being used on the site we were analyzing. Also, the “icl_translations” table is used by the WPML plugin for multilingual installs. However, this site isn’t multilingual. One downfall though to the WP-Optimize plugin is that you can’t sort the rows by data size.
A lot of times plugins are installed and then removed but the database tables are left behind. You can usually safely remove these from your database (we will go into this more in the phpMyAdmin step below). Remember to check with a developer if you aren’t comfortable doing this.
Another big table we noticed was the “tve_leads” table. This is used by the popular Thrive Leads plugin. However, the site in question didn’t use this plugin. So again, if you check your WordPress site you will probably find a lot of leftover tables that should be cleaned up and or removed. The WP-Optimize plugin can be a quick way to look through your MySQL tables and spot them.
You can also check your database size and analyze your tables with phpMyAdmin. Many hosts will have a shortcut to access this within your control panel or perhaps a link in your setup email. If you are Kinsta user you can access phpMyAdmin by clicking into your site, scrolling down to the Database section, and clicking on “Open MYSQL.”
Click on your database on the left-hand side. You can then sort your database’s tables by total size. On the WordPress site we analyzed, over 70% of the large database tables were created by plugins that were no longer being used on the site. Which means our database was using way more disk space than it needed to.
You can easily delete these unused tables by selecting them and choosing “Drop” from the dropdown. We highly recommend that you backup your database before doing this. Check out our quick and easy tutorial on how to backup your MySQL database using phpMyAdmin.
Another way to check your current granular disk usage and database size is to ask your host to provide you with a report. A lot of times the hosting provider can quickly run server commands to generate a tree/granular report on directories to show you what is taking up the most space. It might not always be the prettiest report, but it will give you the data you need. A host should always be happy to assist you in finding ways to clean up unused data, as this is beneficial to both.
Another way to analyze your WordPress disk usage is to dive into the data locally on your computer. This entails connecting to your site via FTP and downloading your entire site. It is important to remember that if your host charges you by bandwidth, that this will use part of your monthly quota. So we don’t recommend doing this all the time, perhaps once every 6 months. Or if you have a smaller site, this probably won’t be an issue. This can however be one of the most powerful ways to analyze your disk usage, as you can dissect the data very quickly, and use a tool of your choice.
The first step would be to connect to your WordPress site via SFTP and download your /wp-content/ folder. Depending on the size of your site, this could take a while.
You can then use a free directory size tool to analyze your site. For Windows, we highly recommend the free TreeSize software, which we will be using in this example. For Mac, you might want to check out OmniDiskSweeper.
You can select your wp-content folder that you downloaded and it will quickly scan it to show you the exact size of everything in it. As you can see below, this is much better than any plugin or export from your server. If you analyze the data locally, you can really take advantage of some powerful tools like this.
If we narrow down into the large folder in uploads we can instantly see that there were some very large images/photos that were uploaded that probably weren’t optimized. The one mind-blown.gif is over 3.5 MB alone, which is way too large for an optimized image. There are some easy ways to compress animated GIFs which should have been done here. And make sure to check out our in-depth post on how to optimize images for web. TreeSize is awesome for quickly digging through your site and spotting issues within seconds.
The last and final way to analyze your disk usage is via SSH. While this is probably for the more tech savvy, we thought we would still include it, as it is pretty easy to do. Simply login to your host via SSH. Then use the following commands. The first will navigate you to your wp-content folder using the “change directory” (cd) command. Note: This location may vary on certain hosts.
You can then use the following command to sort the folder with the smallest files on the top and largest on the bottom.
du -sh * | sort -h
You can go as deep as you need until you find what is taking up the most space on your site. In this case, it is our uploads folder.
As you can see below, our 04 (April) 2016 folder is taking up much more space than our other months and years.
After going into that directory we realized it was due to some very large GIFs being used, as well as duplicate .webp files that were no longer being used.
Reducing Disk Usage in WordPress
Here are a few quick and simple recommendations for reducing disk usage on your WordPress site.
- Optimize your images
- Use a plugin like Media Cleaner to get rid of unused media on your site
- Delete old themes and plugins
- Cleanup unused database tables left behind from plugins no longer being used
- Check your WordPress installation using some of the tips above to ensure large files are there for a reason
- Disable or limit WordPress revisions to keep your database small
- Remove old log files
- Remove backup files and store them offsite
- Cleanup and delete comments in spam or trash
As you can see, there are quite a few different ways to check your disk usage and database size in WordPress, even for those who aren’t very tech-savvy. Remember that over time you probably have accumulated a lot of extra bloat on your site, consisting of both files and tables in your database. Doing a checkup once every 6 months can be a good way to ensure you keep your disk usage to a minimum, reduce storage costs, and help speed up your site.
Do you have any other easy tricks you use to check disk usage on your WordPress site? If so, feel free to share them below in the comments.