Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I know how to backup a filesystem with tar and restore it later, but i'd like to know how to do that with a remote system. I'm really terrible at all command piping stuff and i can't simply adapt the tutorials to my needs. Any help would be appreciated. What i'd like to do is to login as root@remotemachine and issue a tar command on the entire / directory that would save the resulting archive to my local machine. And then i'd like to do it backwards (restore). I've seen some commands on the net ... something like:

ssh -something root@remotemachine "cd /; tar -cpf - ." | tar -xf -

I don't remember it exactly but i now that this command copied the filesystem over to my computer and i don't know how to change it to create an archive instead.

Thank you

share|improve this question

2 Answers 2

Use redirection instead of piping in order to create the file on the local system.

ssh ... "... ; tar ..." > foo.tar
share|improve this answer
    
Thank you, i'll try and report how it went :) And how would i reverse this? Do i have to be connected from the remote machine to the local one to do this, or can i do it from the same local machine? –  Marius Oct 14 '10 at 9:00
    
ssh ... "... ; tar ..x.." < foo.tar –  Ignacio Vazquez-Abrams Oct 14 '10 at 9:03
    
Thanks, i'll try that in a few hours and see how it works. –  Marius Oct 14 '10 at 10:01
1  
Probably best to not extract right to the root directory though. –  Ignacio Vazquez-Abrams Oct 14 '10 at 10:05

I know it's not what you ask for... but if your goal is to backup, there are much more proven tools to do that over SSH.

You might want to check out Duplicity. It can handle incremental backup, as well as encrypt the backup to name a few features. duplicity /home/me scp://uid@other.host/some_dir

share|improve this answer
    
That could be ok, but i'm not sure if it can run on a mac and i'm not sure if it would work for the iphone (that's what i'm trying to backup) –  Marius Oct 14 '10 at 8:59

Your Answer

 
discard

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.