Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'd make a backup of a entire remote filesystem ext3 to a local HD. This operation has to be made using ssh. The backup has to be get from the Client PC and not give to the Server. I hope was clear to explain my issue.

Some one could suggest me how to resolve it?

thank you so much!

share|improve this question
    
Be aware that cloning a mounted filesystem is potentially problematic. It's better to start the box from a rescue disc or from a separate partition. –  loevborg Feb 23 '11 at 23:06
    
You have SSH access to the server, but you can't run any commands? (I'm guessing that's what you mean by 'get from the client, not give from the server'). –  b. e. hollenbeck Feb 23 '11 at 23:08

3 Answers 3

up vote 2 down vote accepted

I suggest using rsync, which can operate over ssh.

rsync -cavz user@remote_host:/remote/path /local/destination

(rsync must be installed on both sides)

rsync is designed to transfer directories from one machine to another using as little bandwidth as possible. By default, it only transfers the deltas between the source and destination.

The options above (-cavz) are the ones I normally use, and tell it to (-c) check checksums; (-a) preserve permissions, timestamps, symlinks, etc.; (-v) be verbose; and (-z) compress the transferred data.

share|improve this answer
    
it's a good choice for make the backup for the files, I'd like make the backup of the entire filesystem for example the /dev/hda1.I've tried it in this way root-> rsync -cavzp admin@X.X.X.X:/dev/hda1 /home/user/Desktop/ the result is protocol version mismatch -- is your shell clean? (see the rsync man page for an explanation) rsync error: protocol incompatibility (code 2) at compat.c(173) [Receiver=3.0.7] –  Riccardo Magrini Feb 24 '11 at 22:17
    
I've received that error just when try to make the backup of the dev if make the backup of a file it's fine –  Riccardo Magrini Feb 25 '11 at 10:45
    
That's because /dev/hda1 is a block device and doesn't look like a file (at least to rsync). Assuming / is mounted on /dev/hda1 (doing df should tell you), you should be able to do "rsync -cavzpx admin@X.X.X.X:/ /home/user/Desktop/backup/" (I think it will 'do the right thing' with /proc and /dev.) The -x tells it to stick with the disk it is on. –  jwernerny Feb 25 '11 at 15:32

The traditional method is to do something along the lines of:

  • On server create an archive of the files to transfer. tar or cpio are typical commands for this.
  • Transfer the archive across the network
  • On client extract the client archive into the final location.

You can either do this step by step, or use unix pipes and tell the archive commands to use pipes instead of actual file archives.

In the old days, I did the following on the machine with the files:

tar cf - . | rsh remotemachine tar xvBpf -

You could probably get things running with a command similar to

ssh servermachine "tar -C /location -cf - ." | tar xvf - 

Good luck

share|improve this answer

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.