How to free up disk space

Guidelines

  1. First, we can check old logs and how much data they contain.

  • /var/log/ → Standard location for system logs, and applications, unless a different location has been specified. Using ls -alh we can list all files, with their size, and with du -h we can see how large folders are. Sometimes, we do not need some archived old logs, so they can be deleted, but only if we are sure that they will not be needed anymore. 

In /var/log/ there are some folders that can contain a large amount of logs. Example: /var/log/http/, which is a standard web server (in most cases, the Apache web server) logs location. In our example, the folder contains a lot of old logs (the ones with a date appended in the end of the file name) whose size is a few gigabytes. They can be deleted if we are sure that they will be no longer required.

Sample output of the ls -alh command (in /var/log/):

  • /servers/(cat/spell/pm)/logs → This is the location for XTM Cloud application logs, or the corresponding localization on your server, depending on the settings made during installation. Here we can also see files with a date appended at the end of the file name. As explained above, those files can be deleted if no longer required:

Sample output of the ls -lh command (in /servers/pm/logs):

  1. Second, we move to XTM Cloud files:

We can check and delete files in temporary catalogs, if they have not been cleared automatically. There are many ways to do so, but the most efficient is to use a bash script and modify it to suit your needs. A good example of such a script is this one:

#!/bin/bash

find /xtm/webapps/generatedfiles -mindepth 1 -mtime +30 -delete > /dev/null 2>&1

find /xtm/xtm/temp -mindepth 1 -mtime +30 -delete > /dev/null 2>&1

find /xtm/xtm/nlpservice -mtime +7 -delete > /dev/null 2>&1

find /xtm/xtm/data/ -maxdepth 2 -name Download |xargs -n 1 -I D find D -ctime +7 -delete

find /xtm/xtm/data/ -maxdepth 2 -name temp |xargs -n 1 -I D find D -ctime +7 -delete

find /servers/cat/temp -mindepth 1 -mtime +1 -delete

find /servers/pm/temp -mindepth 1 -mtime +1 -delete

find /servers/spell/temp -mindepth 1 -mtime +1 -delete

exit 0

IMPORTANT!

Bear in mind that the paths shown above are the standard installation paths for the XTM Cloud application. If you have different ones then edit it accordingly!

To create such a file, do as follows:

  1. Create a file: vim clean_temp_xtm.sh.

  2. Once in the program, press i and then paste the above content into the file.

  3. Press Esc and the combined keystroke :wq to save and quit.

  4. Add executable rights for a file: chmod +x clean_temp_xtm.sh;

  5. Run the script: ./clean_temp_xtm.sh.

  1. Lastly, we can delete archived or unused projects.

IMPORTANT!

Only do so when you are sure that you will never need them again: when a project has been deleted, that cannot be undone!

  • Go to /xtm/xtm/deleted/ or /xtm/xtm/archived (if you have a non-standard installation path, use your installation path(s) instead).

  • Inside this folder/those folders, you will find – the IDs of projects that have either been deleted or archived and you can choose which projects you can delete, if any.


Deleting database dumps

If you ever made some database dumps, there is a possibility that they were not deleted after the dump or restore.

Check your bash history to find out if some hints are there.

  • In the console, use history | grep -i 'pg_dump' – this command will list the bash history. It can be summarized as the pg_dump command.

  • You can then check the folder in which the dump was placed, and delete it if needed. If there is no pg_dump in bash history, you can always check if there are any unneeded leftover files in /servers/files/.