December, 2023

Recovering Disk Space by Deleting TMP files

When working on a problem for a customer, it was noticed there were several temporary files on the mail server in the /mail directory. This customer’s Domino servers run on the IBM i, so there are multiple Domino servers on the system, a total of four. I decided to do a search to determine how many temporary files existed on the entire IBM i system and where they were located.

I used the following command in Qshell to search for all of the files that ended in .TMP:

find /*| grep “.*.TMP$” | xargs ls -l >TMPFiles_WithCreationData.txt

The resulting file contained the Permissions, Owner, Object Size, Month/Day/Year the file was created along with the Directory Location. Below is a sample of what the resulting data looked like:

Because Qshell is case sensitive, I also did a search for all files ending in .tmp. I imported the data from both searches into a spreadsheet and did some calculations, the results were quite interesting:

  1. The oldest files dated back to 1996!
  2. Almost all of the .TMP/.tmp files on the mail server were in the /mail directory
  3. All but two of the .TMP/.tmp files on the application server were in the data directory
  4. The total size of all of the .TMP/.tmp files was just under 1.5 TB!

After presenting the data to the customer, we received permission to schedule time to take the servers down, delete the temporary files, and restart the servers.

I used the rm command to do the deletions. Below are the steps to invoke QShell, change into the directory to perform the deletions in, issue the ls command to list out the files and then issue the rm command to delete the files.

  1. qsh
  2. cd /notes/data/mail
  3. ls *.tmp
  4. ls *.TMP
  5. rm *.tmp
  6. rm *.TMP

Happy deleting!