Skip to content

Fixing a cPanel Insufficient Disk Space Problem

So I logged into our company website’s WHM portal the other day and noticed that the most recent cPanel update had failed due to insufficient disk space. Here was the message:

The last attempt to update cPanel & WHM was blocked.
 Please correct these issues and rerun updates.
 fatal: Cannot upgrade due to insufficient disk space. Detected 1.97GB. You will need at least 3GB to install/update to a new version of cPanel.

Sounds simple enough, right? However, a quick check of the server revealed that:

  • /usr had only been allocated 8GB
  • /usr was 76% full

A quick Google search turned up some tips for freeing up disk space in /usr (where cPanel lives). Searching for and deleting large log files only freed up about 500MB, still quite far from the 3GB we needed. Unable to move further, I contacted the technical support team of our hosting provider. They provided me with the syntax to find large files in Linux. Back to square one.

Luckily, Uplogix employs a team of highly talented developers who know Linux far better than I do. Since the server had so much space in /home (100GB free), they suggested simply moving /usr/local/cpanel to /home/cpanel.

What Didn’t Work

Our first attempt went like this:

  • shut down cpanel process
  • copy /usr/local/cpanel to /home/cpanel
  • mv /usr/local/cpanel to /usr/local/cpanel.bak
  • create a symlink from /usr/local/cpanel to /home/cpanel
  • start cpanel process

Unfortunately, we were greeted with 500 Internal Server errors when we tried to connect to cPanel and WHM. We guessed this was a permission problem.

What Did Work

It turned out that I was searching for the wrong terms, and after more Googling, found Moving cpanel location from /usr/local to home. User Eddie suggested we use a bind mount instead of a hard link.

mount --bind /home/cpanel/ /usr/local/cpanel/

Here were the steps:

  • shut down cpanel process
  • copy /usr/local/cpanel to /home/cpanel
  • move /usr/local/cpanel to /usr/local/cpanel.bak
  • make a new directory: /usr/local/cpanel
  • bind /usr/local/cpanel to /home/cpanel
  • start cpanel process

Even without deleting /usr/local/cpanel.bak, the cPanel update completed without issue.

PROBLEM: The mount command we ran won’t persist across a reboot.

SOLUTION: Add the mount command to /etc/fstab

root@upxwebserver [/usr/local]# cat /etc/fstab
# wasn't enough space in /usr/local for cpanel, so we had to move it to /home 
/home/cpanel /usr/local/cpanel none defaults,bind 0 0

We then rebooted the server and everything continued working fine.

Problem solved.

Thanks to Matt for steering me away from trying to resize the partitions on the server. Additional thanks to Jeremy for playing Clash of Clans on his phone when the going got tough.

Published inTechnology

Be First to Comment

Leave a Reply

Recent Reviews

Daniel Verastiqui’s best book yet. I have read a couple of his books before, and was graced with an advanced copy. Perion Synthetics is his best book yet. He follows different characters, giving you a well rounded view of the futuristic world through many different lenses, leaving you frantically reading for more, unable to put the book down. Throughout the whole book, you are not only entertained with an interesting story, but left with a nagging thought of what is truly a human soul vs artificial intelligence, and what are its rights. I have dismissed such conversations before, but Perion Synthetics presents some realistic issues we may face in the not too distant future. For those needing to know more specifics for youths reading it: There is explicit language, sex, and violence. This may not be a book for people under 16. But for science fiction readers who don’t mind that like I do, this book is a great read. I recommend it for anyone’s library. Related

Lauren Ellis – Perion Synthetics

I love being fooled by a story. There was something about the multiple storylines that nagged at me, something not quite right… Until it was, and my “NO WAY” echoed in the room. I think in the back of my mind I knew “something was up” but it turned out I was one the wrong side of the line. I can’t wait to read it again, to see how many ways the author told me what was happening and I just missed it. That’s a win in my book. Related

M. Grubbs – Por Vida
© 2018 Daniel Verastiqui