SysAdmin Tale #130325

A friend of mine has a VPS on OVH and asked me to review if there is anything he can remove to make more space and install PHP 8.2. Here is the email I sent to him, in which I shared the diagnosing commands he can use.


Linux Sysadmin Tales

SysAdmin Troubleshooting Tales is a category of articles designed to share knowledge with junior sysadmins. Dive into the world of Linux system administration with straightforward articles that unravel the intricacies of troubleshooting. Learn practical solutions, tips, and tricks to tackle both common and uncommon sysadmin challenges. Whether you’re a seasoned professional or an aspiring tech enthusiast, this blog offers invaluable insights into the art of server management and problem-solving.


Here is my email to him:

Checking any possible disk clearing and studying the case for installing PHP 8.2

Salam,

I reviewed your VPS and its disk space as requested. This VPS has a 20GB disk and 2GB of RAM.

I noticed that there is a swap file, created on October 6, 2021. Swap files are intended to function as additional RAM.

Disk usage analysis shows:

root@vps648241:~# du -sh /* | sort -rh8.1G    /swapfile7.7G    /var1.4G    /usr1.2G    /root...

You can then dive into the path /* to explore further size distribution. You can also use find to determine the size of large files:

root@vps648241:~# find / -type f -size +100M -exec ls -lh {} \; | sort -rhk 5-rw------- 1 root root 8.0G Oct 6 2021 /swapfile1-rw-rw---- 1 root utmp 112M Mar 1 06:24 /var/log/btmp.1

However, this swap file is currently not in use:

root@vps648241:~# free -m              total        used        free      shared  buff/cache   availableMem:           1945         787          93         108        1064         874Swap:             0           0           0           0           0           0root@vps648241:~# cat /proc/swapsFilename                Type            Size    Used    Priority

So it’s just a waste of valuable space.

This file may have been created by support in response to a previous RAM issue you had, or it may have been an attempt you had to add more RAM.

I believe it is safe to remove the swap file because technically it’s not in use. As a precaution, I have also taken for you a backup of this file. It will be removed within the next month to allow for observation of any potential system dysfunction that we may be unaware of. If swap space is required in the future, a smaller swap file, such as 4GB, can be created. As for now, you can remove it safely:

rm /swapfile1

As for PHP, however, I see that the OS is Ubuntu 18.04, which has reached its EOL (end of life) years ago. Unfortunately, support for Ubuntu 18.04 was also removed from Ondrej’s PHP PPA on June 15, 2023.

To avoid any complications, such as a series of compilations and dependencies when trying to install it, and to maintain an updated and easy-to-use VPS, I believe an upgrade is required. However, upgrade operations are delicate and require a backup.

I also see that the virtualization in use is KVM, which is a good thing:

root@vps648241:~# systemd-detect-virtkvm

As we probably won’t have kernel limitations (which would have been the case with OpenVZ containers, for instance). Therefore, we have two options:

  1. Option 1: We take a snapshot of the VPS or backup the website, databases, and any other software/files in use. Choose a time with minimal activity and then try a gradual LTS upgrade to 20.04, then 22.04, then 24.04, while upgrading all the software in use.
  2. Option 2: Get a new VPS and migrate to it in parallel.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *