Determine available disk space on your cloud storage drive

Determine available disk space on your cloud storage drive

You can see the amount of available disk space you have on your MySecure.Space client area. The amount you see there is updated approximately every 10 minutes.

Via SFTP

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>.your-storagebox.de
echo "df -h"  | sftp <username>@<username>.your-storagebox.de
echo "df -hi" | sftp <username>@<username>.your-storagebox.de

Via SSH

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

ssh -p23 [email protected] 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 [email protected] df -m
Filesystem   1M-blocks Used  Avail Capacity  Mounted on
uXXXXX          102400    0 102399     0%    /home

Via LFTP

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:

TARTARUS_POST_PROCESS_HOOK() {
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"}'
}
Related Articles