Stream a tar backup directly to another server over SSH
tar over ssh to remote server | backup when disk is full | create archive without local copy | back up directly to backup server | tar | ssh | backupCaution: This command changes the system. Understand what it does before you run it.
tar -czf - -C /var/www/vhosts/example.com/httpdocs . | ssh webuser@backup.example.com 'cat > /home/webuser/backup/example.com-httpdocs.tar.gz'tar writes the compressed archive to standard output (-f -), SSH pipes the stream to the target server, where cat writes it to a file. No local space is needed for the archive. Exactly right when the disk is already full and you need a backup before cleaning up.
Note: An existing target file is overwritten. After the transfer, check with ssh BENUTZER@HOST 'tar -tzf ZIEL > /dev/null' that the archive is fully readable.
Also searched as
- tar over ssh to remote server
- backup when disk is full
- create archive without local copy
- back up directly to backup server