Copying server backup to a local virtual machine using tar command
For backing up a Linux ubuntu setup I use this command:
sudo tar -cvpzf backup2018.tar.gz --exclude=/home/server/backup2018.tar.gz -- one-file-system /
This works really good. It stores all relevant files in a zip file. The problem is that my hard drive is too small to make a backup. That's why I would like to back up the files directly to a local virtual machine over the internet. How can I do this?
Use a SSH connection to the dump server
You can attach an SSH prompt to open an SSH connection to the target host. This would look like this
sudo tar -cvpzf backup2018.tar.gz --exclude=/home/server/backup2018.tar.gz -- one-file-system / | ssh email@example.com "cat > /backup/backup2018.tar.gz"
In this example, I took webprog24 as dump host. Before this works you have to establish an SSH-connection using SSH-keyfiles.