How to Resolve Cpanel Partition Disk Space Is Full Error
Sometimes a lot of random stuff starts consuming a lot of your disk space in cPanel. This can result in a partition disk space being a full error in cPanel. In this tutorial, we’ll guide you through how to find what is taking up most of your disk space and how to free it.
How to Free Disk Space in Cpanel?
First things first, use the def command to check if the disk space is actually almost full.
You should see an output similar to below:
df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 8.7G 0 8.7G 0% /dev tmpfs 8.7G 7.6M 8.7G 1% /dev/shm tmpfs 8.7G 59M 8.7G 1% /run tmpfs 8.7G 0 8.7G 0% /sys/fs/cgroup /dev/mapper/centos-root 51G 36G 16G 73% / /dev/sda1 1016M 351M 664M 35% /boot /dev/mapper/centos-home 1.8T 2.6G 1.8T 1% /home /dev/loop0 2.2G 195M 1.9G 10% /tmp tmpfs 2.6G 4.0K 2.6G 1% /run/user/42 tmpfs 2.6G 40K 2.6G 1% /run/user/0
The fifth line in the output above says that the /dev/mapper/centos-root partition is 73% filled. This is the root partition, i.e., all the other partitions are included in this partition so it makes sense to investigate this partition and this partition alone. Make sure that you’re not including other partitions or it’ll end up taking a lot of time.
After getting the results you’ll be able to see the partition consuming the most space. See the name of that partition and execute the following command by replacing $partitionpath with the file path.
du -h --max-depth=1 -x /$partition | sort -hr
Consider the following example,
# du -h --max-depth=1 -x /usr | sort -hr 22G /usr 16G /usr/share 3.9G /usr/local 2.1G /usr/lib64 2.2G /usr/lib 413M /usr/bin 272M /usr/src 181M /usr/sbin 162M /usr/libexec 40M /usr/include 0 /usr/selector.etc 0 /usr/selector 0 /usr/games 0 /usr/etc
Here the /usr/share is consuming the most space. Now we’ll use the command mentioned above by replacing $partitionpath with /usr/share
# du -h --max-depth=1 -x /usr/share | sort -hr
Now that you’ve found the directory consuming the most space, you can check individual files within the directory. You might end up finding out log files or backups that you forgot to clear.
Now you can decide what to decide and what to keep in order to free up space in the disk.
- Click here to know more about the Best cPanel Hosting Providers.