How to free up disk space in cpanel? But first, find out what is taking all the space by using Terminal? Here is how...
If you are getting messages on your linux server saying that there is no free space, here is quick way how to check it. Type this command:
df -h
you should get output like this:
Filesystem Size Used Avail Use% Mounted on
/dev/vda2 492G 489G 0 100% /
tmpfs 2.9G 0 2.9G 0% /dev/shm
/dev/vda1 243M 62M 169M 27% /boot
OK, now we know - disk named /dev/vda2 is full, but what is taking all that space? Let's find out...
Go to your root folder cd /
and type this command:
du -h --max-depth=1
it will take a while until system calculates all folders sizes, but after some time (about 1 min or less) you will get the results:
0 ./proc
4.0K ./selinux
8.0M ./bin
383M ./opt
4.0K ./media
0 ./sys
60M ./boot
4.0K ./srv
401G ./backup
310M ./lib
16K ./lost+found
16M ./sbin
8.0K ./test
11G ./usr
27M ./lib64
236M ./root
148K ./dev
...
In our case we can see that our backup folder is actually taking a lot of space. So we can go into that folder and type again du -h --max-depth=1
cd /backup
du -h --max-depth=1
and we will see same list of folders and their sizes...
once you find out what is taking most of your space, you can delete those files (if they are not needed any more...) by using command:
rm -r -f [your_folder_name]