Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to backup a website, but I am working within size constraints. I've tried the old

tar -cpzf backup.tar.gz *

but there isn't enough free space on the host to write the file. I have a few other servers that have enough space and that support SSH though.

How would I redirect the output of the tar command (using >) to another server?

If this isn't feasible, is there a better way to do this aside from just using up a ton of bandwidth by SSHing into the other server and from there using FTP over SSH to download all the files and tarball them up?

share|improve this question
up vote 3 down vote accepted


tar zcvf - /wwwdata | ssh "cat > /backup/wwwdata.tar.gz"

You might want to use rsync over ssh instead.

share|improve this answer
Yeah, best to use rsync... but cool tar trick I didn't know! – arkigos Jul 8 '11 at 17:57

You can pipe tar thru ssh. Steps on Linux:

share|improve this answer

Here is my backup script it taks backup of website and mysql

share|improve this answer
The OP doesn't have space to store tarballs locally on his server. Your script requires this. – EEAA Jul 8 '11 at 17:36
Ahh sry must havet overlooked that – Ninja Jul 8 '11 at 17:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.