How to check folder sizes in Gridpane

For those of us who are not natural users of the Command Line Interface, it can get pretty frustrating not knowing where all the space is going in your server. Although Gridpane provides m/monit to show a storage usage summary, it really tells you nothing more than the total used in parent folders… which tells you nothing.

Sometimes, all you want to know is – Which website is taking up all that space?

Step 1: SSH into your server via Putty

Sorry mate, if you were looking for a pretty interface… not yet. I’m guessing Gridpane is working on it, but for now you’ll still have to do CLI. It’s not that hard though – see a quick tutorial here – How to give limited access to developers in Gridpane. Come back here once you’ve completed Step 5 in that article and have logged in as root.

Step 2: Do some digging

From m/monit you should be able to identify the main folders that take up most space.

Let’s start with /var/www. From Putty, type the following:

cd ./var/www
  • cd = Change Directory
  • . = Move within the current folder path
  • /var/www = Folder to which you want to change to

Then type/copypaste the command below:

du -h --max-depth=1 | sort -h
  • du = Disk Usage
  • -h = Human-readable format
  • –max-depth=1 = Limits the results to just one level (else you’ll see the results for all subfolders)
  • sort -h = Sort by size (largest folder at the bottom)
Tip: Ctrl+V doesn't work in Putty. To paste text, just right-click your mouse button inside the Putty window.

Tada! You now know which site consumes the most space. You can repeat the steps above to dig further to identify exactly which folder is taking up all that extra space. For example:

cd ./superwebsite.com (Goes forward into the subdirectory "superwebsite.com")
du -h --max-depth=1 | sort -h (lists each folder and storage used)
cd .. (Go up one folder level. It's important to have the space after cd. You'll be back in var/www.)
cd /opt/gridpane/backup (Jump to the opt/gridpane/backup folder)
du -h --max-depth=1 | sort -h (List storage again)
cd .. (Go up one level)
cd ~ (Jump straight to the root folder. You can also use cd /)

etc etc etc

Thanks to this, I found an abandoned Updrafts backup folder (250MB), an unused WP Debug log (1.2GB lol), unused Snapshots (6GB!), and a bunch of other stuff I didn’t know about.

For more commands

The Gridpane documentation covers more basic CLI commands, and is where this tutorial came from (technically Tom DeBello answered my question in my support ticket, which resulted in this article, which I wrote for myself as much as for you haha. So thanks Tom and the GP team!).

I hope this little tutorial has helped you resolve some of the mysteries in your server. Good luck!

PS – If you have any questions… ask the GP team lol. I’m nowhere near as capable as those guys.

Share via
Copy link
Powered by Social Snap