Remote Backup Using SSH and TAR
I have one of those three-year free trial hosting accounts from 1&1. It’s coming due at the end of the year and their documents say upgrading the account (that is, actually paying for it) requires the site be backed up and restored to a new account. It’s annoying, but whether I do this or move to another host, the backup needs to be made just the same. I have been backing it up manually by logging in to the account and making a TAR of the site, then transferring it to my local computer with FTP. The problem is, the site has a 500MB limit and I’m using 400MB of it, so there isn’t room for the files and a compressed TAR backup. SSH to the rescue! I’ve found lots of sites that show you how to back up using SSH and TAR this way:home$ ssh user@example.com
user@example.com's password:
example$ tar zcf - . | ssh user@home-machine.net "cat > example.tgz"
If you can’t SSH to your local machine, you can do it this way:home$ (ssh user@example.com tar czf - .) > example.tgz
user@example.com's password:
The restore command is:home$ cat example.tgz | (ssh user@example.com tar xzf -)
user@example.com's password:
or to restore to a different location:home$ cat example.tgz | (ssh user@example.com "cd temp; tar xzf -")
user@example.com's password: