Determine available disk space

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

echo "df"     | sftp <sr-your_storage_number>.mycoreserver.com
echo "df -h"  | sftp <sr-your_storage_number>.mycoreserver.com
echo "df -hi" | sftp <sr-your_storage_number>.mycoreserver.com

Under certain circumstances, lftp can return wrong 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"}'
}

 

Got a question? Connect with us and Create a Ticket.

  • diskspace, Space, Available, availablespace
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Offsite Storage Space Service & Access Overview

Offsite Storage Space Service & Access Overview As they say: "ALWAYS BACKUP YOUR DATA!!!" -...

Access with FTP/FTPS

FTP/FTPS You can access your Offsite Storage Space by using FTP. Please use your assigned...

Access with SFTP/SCP

SFTP/SCP By using SFTP and SCP, you can access your Offsite Storage Space. This is...

Access with SSH/rsync

SSH/rsync  You can access your Offsite Storage Space via an SSH connection to use rsync there....