SFTP Gateway Managing Disk Space
Note: This page applies to SFTP Gateway version 2.x. Visit Here for documentation on version 3.x.
Overview
In SFTP Gateway 2.001.00, we have identified an issues where the Linux disk can fill up over the course of a few weeks, if the server is under heavy load.
This article covers a workaround to keep disk usage under control.
Problem
In the CloudFormation templates, the default size of the EC2 volume is 32 GB. Under light usage, this should be enough disk space.
The operating system and files for a default installation take up around 5 GB.
If the server is under heavy load, various log files can take up over 6 GB of storage, even when rotated. These logs include:
/var/log/messages
- LDAP logs
- Cron logs
- AWS logs
Also, there is a folder /ts-tmp
that contains command-line output
for task spooler commands. There are a few processes that use the
task spooler.
This folder can grow indefinitely in size, because it's not a traditional log file managed by logrotate.
And under heavy load, the /ts-tmp
can use up the remainder of your
server storage within a matter of weeks.
Diagnosing and troubleshooting
To determine whether you are low on disk space, run the command:
sudo su
df -h
You should see the following output:
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 32G 14G 19G 43% /
To see how much of this storage is being taken up by /ts-tmp
, run
the following commands:
cd /ts-tmp
du -sh .
Cleaning up files
You can immediately clear out old files, using this command:
find /ts-tmp -mtime +1 -type f -exec rm {} \;
This will search for any files in the /ts-tmp
directory that are older
than a day, and then delete them.
To automate this process, you can run a daily scheduled task. Run this command:
sudo su
crontab -e
And append the following entry:
0 1 * * * find /ts-tmp -mtime +1 -type f -exec rm {} \; > /dev/null 2>&1
Once a day, this will delete /ts-tmp
files older than a day old.