Azure Managing Disk Space
Note: This page applies to SFTP Gateway version 2.x. Visit Here for documentation on version 3.x.
Overview
Disk space can fill up over time on the VM. If the disk is completely full, this article has some troubleshooting commands to free up some immediate storage.
Problem presents itself as an LDAP error
When you run out of disk space, the first indication is usually a big red error on the web admin UI:
localhost:636; nested exception is javax.namaing.CommunicationException:
localhost:636 [Root exception is java.net.ConnectException: Connection
refused (Connection refused)]
This specific error means that the LDAP service is down.
You can try restarting LDAP (see this article).
If LDAP does not come back up, try checking available disk space:
sudo su
df -h
You should see the following output:
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 30G 30G 0G 100% /
...
If the root partition is at 100%, you will need to free up storage before attempting to restart LDAP.
Free up some storage
Here are some commands you can safely run to free up disk space.
sudo su
azcopy jobs clean
This clears out AzCopy logs, which can accumulate over time in the /root/.azcopy/
directory.
If the command appears to hang, this is a good sign. This means the command is clearing out a lot of storage.
Open a second SSH session to continue clearing up disk space.
sudo su
find /ts-tmp -mtime +1 -type f -exec rm {} \;
This clears up day-old temp files in /ts-tmp
, which are normally used to
store output from the task spooler.
Again, it's a good sign if this command hangs. It could be cleaning up a lot of storage, so let it run -- even if it takes hours.
Open a third SSH session to continue clearing up disk space.
sudo su
cd /var/log/
find . -type f -size +40M
This command searches for large log files. Look at the search results, and delete anything you don't need.
For example, LDAP access logs are a good candidate, because they take up a lot of space, and nobody looks at them anyway.
Preventing this from happening again
Look for the following file:
ll /etc/tmpfiles.d/ts-tmp.conf
If it doesn't exist, run the following command:
echo "D /ts-tmp 0755 root root 1d" | sudo tee /etc/tmpfiles.d/ts-tmp.conf
This file will configure systemd to clear out old /ts-tmp
files
on a daily basis.
For AzCopy logs, you can add a cron job to execute azcopy jobs clean
on a scheduled basis (e.g. weekly).
You can also resize the VM disk (see this article).
Finally, you can monitor the VM disk utilization. This is something you would configure on your own -- unfortunately, we don't have an article to configure this yet.