Koozali.org: home of the SME Server

[Solved] rsync over ssh question

Offline smiit

  • **
  • 41
  • +0/-0
[Solved] rsync over ssh question
« on: January 26, 2007, 10:36:36 PM »
Hello all.  I've been trying to implement an rsync over ssh backup script written by silasp from this thread:

http://forums.contribs.org/index.php?topic=31246.0

I can ssh from the backup server to the main server using key pairs with no errors.

However, any test run of rsyncing a directory from the main server (6.0.1) to the backup server (7.1) gives this error:

[root@backupserver ~]# rsync -aqH -e ssh root@mainserver:/etc/test1/test2/ /backups/daily/etc/test1/test2/
receiving file list ... done
rsync: mkdir "/backups/daily/test1/test2" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at main.c(529) [receiver=2.6.9]


It doesn't appear to be inadequate permission to create directorys on the backupserver since it all runs as root.

Both servers are local for testing before moving the backupserver offsite.

I feel like the answer is right under my nose but I'm scratching my head.

Thanks for any help.

Offline Jean-Philippe Pialasse

  • *
  • 2,760
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
[Solved] rsync over ssh question
« Reply #1 on: January 26, 2007, 10:43:18 PM »
you just need the first time you use rsync do  via ssh:

Code: [Select]
mkdir -p /backups/daily/etc/test1/test2/

to create the backup dir, if the destination directory for backup does not exist rsyn can create it but not recursively.

Offline smiit

  • **
  • 41
  • +0/-0
[Solved] rsync over ssh question
« Reply #2 on: January 26, 2007, 11:01:02 PM »
Quote from: "unnilennium"
you just need the first time you use rsync do  via ssh:

Code: [Select]
mkdir -p /backups/daily/etc/test1/test2/

to create the backup dir, if the destination directory for backup does not exist rsyn can create it but not recursively.


Thanks - that did the trick for this single example but ...

What happens if I'm trying to keep a fileserver in sync where directorys and paths are constantly being created, deleted, renamed, etc.?

In silasp's script, he specifies, among others, the entire /home/e-smith/ directory - I assumed all of the recursive directories would get created ahead of time automatically?   But I'm only getting errors like in my original post.

Thanks again

Offline psoren

  • *
  • 371
  • +0/-0
[Solved] rsync over ssh question
« Reply #3 on: January 26, 2007, 11:40:46 PM »
Quote from: "smiit"

In silasp's script, he specifies, among others, the entire /home/e-smith/ directory - I assumed all of the recursive directories would get created ahead of time automatically?   But I'm only getting errors like in my original post.

Thanks again


I have a backup running over ssh, it creates the directories under the main directory with no problem:

rsync -avz -e ssh --delete --update --stats root@domainname.xxx:/home/e-smith/files/ezmlm/ /ibays/bjarne_bu/files/ezmlm/

So everything below ezmlm gets created.


Per

Offline Jean-Philippe Pialasse

  • *
  • 2,760
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
[Solved] rsync over ssh question
« Reply #4 on: January 27, 2007, 06:29:26 PM »
exact , rsync has no problem to do his job inside his root backup directory, but is unable to create it recursively  it if it doesn't exist and his parent directory doesn't exist.

so now you create it rsync will deal with all the rest... : his job.


JPP

Offline Gaston94

  • ****
  • 184
  • +0/-0
[Solved] rsync over ssh question
« Reply #5 on: January 28, 2007, 02:55:11 PM »
Hi,
the only point you missed was rsync manual, I guess the command you expect to run was :
Quote
# rsync -aqH -e ssh root@mainserver:/etc/test1/test2 /backups/daily

and not the one you typed ;) if you want "/backups/daily" to be the "root" of your backup files.
Rsync will manage to update recursively your directory tree according to what is on your source, but you also have to consider what you want to happen with files you are deleting on the source ...

G.

Offline smiit

  • **
  • 41
  • +0/-0
Solved!
« Reply #6 on: January 29, 2007, 01:34:26 AM »
:D

Thanks to everyone who read and helped out.  I also received help from the script's author, Silas and yes, it was just a matter of creating the parent directories beforehand.

I had been testing it with small directories before tackling the big /e-smith/home batch of files and wasn't doing mkdir -p for the main directories.

Silas' script appears to be a great way to set up another level of redundant, secure off-site backups.

SME - a great product and, more importantly, great people.

Cheers   :pint: