Backup files on a remote Linux server using ‘tar’ and SSH
Have you ever been in the situation where you have to backup a server that is 100% full and you really can’t free up any space even to create an archive.
Yeah if you’re on a cloud server you can just add some more storage, but how about when you’re actually migrating a physical one to the Cloud?
There’s an easy, little one liner that could save you in that case:
tar czf – /var/src_folder | ssh root@server.cloudbalkan.com “cat > /var/dst_file.tar.gz”
What it does is that it archives or tarbals the source folder, compresses the output and directly streams it over ssh to a remote server and save it into a file there.
This way you don’t need any free space to temorarily store the archive on the source server.
You could also use those command to backup your servers on a remote machine on a schedule using a cron.
Your ideas on solid ground
CloudBalkan