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

Great extrapolation of today’s media and Artificial Intelligence. Reminiscent of William Gibson and Neal Stephenson. Great extrapolation of today’s media and Artificial intelligence. I think this guy is a great new talent and look forward to reading more of his work. Highly recommend. Related

S.A. McInnis – Perion Synthetics

(Disclaimer: Daniel provided me with a free advanced copy for feedback and review purposes.) To start with, I really appreciate receiving an advanced copy from the author. That was a first for me since I signed up with the program on Goodreads. On to the book review… I thought that Verastiqui created an interesting story line and developed the characters well. There were many times while reading it that I had a tough time putting the book down. It was an interesting concept: a great innovator is dying and tries to build a replacement that he can transfer his mind into. I liked this part of the book. What I didn’t like was how quickly the characters bought into some of topics brought up in the book. There were times that the characters made 180 degree shifts in beliefs without the turmoil that usually comes with it. It frustrated me that they changed their deep down beliefs without any concerns. At one point, one of the characters tries to kill the other and without any ‘making up’, they work together at the end. Personally, I have a tough time believing that someone that tried killing me a half hour earlier, can now be my best friend if there wasn’t something else that happened in the middle. That was a tough thing for me to get over and the only reason I dropped down the rating. Overall, it was worth a read and if you can get over some of the major shifts I mentioned, it was an enjoyable read. Related

Manoj – Perion Synthetics
© 2018 Daniel Verastiqui