Determine available disk space

Last change on 2022-09-21 • Created on 2020-05-18 • ID: RO-142E6

You can see the amount of available disk space you have on Robot. The amount you see there is updated approximately every 10 minutes.


To determine in a script how much available disk space you have, use the program "sftp" in Linux-based systems:

echo "df"     | sftp <username>@<username>
echo "df -h"  | sftp <username>@<username>
echo "df -hi" | sftp <username>@<username>


As an alternative, you can also use the extended SSH service to see the disk usage:

ssh -p23 df -h
Filesystem      Size    Used   Avail Capacity  Mounted on
uXXXXX          100G     17M    100G     0%    /home

You can use the argument -m to get the output in megabytes:

ssh -p23 df -m
Filesystem   1M-blocks Used  Avail Capacity  Mounted on
uXXXXX          102400    0 102399     0%    /home


Under certain circumstances, lftp can return incorrect values; therefore it is better to use the variant with sftp. Below is the variant with lftp:

# apt-get install lftp
# echo du -hs .  \
| lftp -u <username>,<password> BACKUPSERVER

You can also embed the command in Tartarus using a hook. To do this, insert the following lines into the Tartarus configuration:

echo "du" | /usr/bin/lftp -u "$STORAGE_FTP_USER,$STORAGE_FTP_PASSWORD" "$STORAGE_FTP_SERVER" | awk -v LIMIT=100 '$2=="." {print ((LIMIT*1024*1024)-$1)/1024 " MiB backup space remaining"}'

Robot Webservice

In order to always get a reliable value, we recommend that you use Robot to display the amount of occupied memory space. You can do this automatically via our Robot Webservice.

Table of Contents