Server disk notifications
What kind of server disk notifications can I subscribe to and what actions do I need to take?
Disk (getting) full
You can use the documentation below to act on the notifications "Disk getting full", "Disk almost full" and "Disk is full".
Log in to the environment of the disk notification.
Navigate to your domain folder /home/<username>/domains/<domainname>
Run the command ncdu
, which will analyze the disk usage.
After the scan is done, you will see output that looks similar to:
--- /home/hipex/domains/hipex.io -------------------------------------------------------------------------------------------------------------------------------------------------------------
58.8 GiB [##########] /application
17.0 GiB [## ] /application-backup
1.8 GiB [ ] /var
4.0 KiB [ ] redis.json
@ 0.0 B [ ] public_html
As you can see in this example, we have a lot of data in the application-backup
folder.
Navigate to the application-backup
folder using the arrow key and press enter on application-backup
folder.
--- /home/hipex/domains/hipex.io/application-backup -------------------------------------------------------------------------------------------------------------------------------------------------------
/..
11.8 GiB [##########] /backup
We are going to delete this folder, press on the d
key to promp the delete screen.
Navigate to yes and press enter to delete the folder
โโโโConfirm deleteโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Are you sure you want to delete "backup" โ
โ and all of its contents? โ
โ โ
โ yes no don't ask me again โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Disk inodes (getting) full
What are inodes?
The Linux filesystem contains objects, each object is represented by an inode. A object is file under the Linux system, for example 1 session file is 1 inode.
When you receive this notification you need to take the following steps.
Check the Inodes used:
df -i
Output:
[/home/hipex/domains/hipex.io]$ df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
devtmpfs 991422 347 991075 1% /dev
tmpfs 997404 1 997403 1% /dev/shm
tmpfs 997404 650 996754 1% /run
tmpfs 997404 16 997388 1% /sys/fs/cgroup
/dev/sda1 4780464 734745 4045719 95% /
As you can see, the Inodes on SDA are currently for 95% in use, which is quite a lot.
To print out the inode usage for the current user, you can use the following command:
{ find ~/ -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -n; } 2>/dev/null
This allows you to idenfity candidates that you can clean up to free up inode usage.
Too many session files
In many cases, a high inodes usage is caused by a huge amount of session files being stored on the server.
To solve this problem, we can clean the sessions that are older than 14 days:
find /var/domains -mtime +14 -regextype sed -regex ".*/session/sess_[a-z0-9]\{26\}" -delete && find /var/domains -mtime +14 -regextype sed -regex ".*/sessions/sess_[a-z0-9]\{26\}" -delete
After this is done, verify if the Inodes usage is below 95%, if not you can use the same command and change the value from 14 days to 7. To prevent this from happening in the future, we advise to use Redis for handling sessions..