Determine available disk space

جدول المحتويات

Determine available disk space

You can see how much disk space you have available in the client area. There is an update about 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 uXXXXX@uXXXXX.your-storagebox.de 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 uXXXXX@uXXXXX.your-storagebox.de 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"}'
}

client area #

In order to always have a reliable value, we recommend using the client logic to display the amount of memory space occupied. You can do this automatically.

مع تحيات فريق عمل حياه هوست

All rights reserved to Hayat Host 2023