Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am using rsync and crontab to schedule a nightly backup.

However, want to do a full-backup and not incremental.

I am using the following rsync in my script file.

rsync -razv dev@xx.xx.xx.xx:repos /home/backup_sys_user/repos_backup

And I want to create the structure below:

/repos_backup/10.10.2010
             /11.10.2010
             /12.10.2010

Is there anyway rsync can do this. I know if can create the directory using the --backup-dir=DIR but this is only for incremental. I want to do a full backup.

Many thanks for any advice,

share|improve this question
    
The output directory for rsync always contains a full backup. It applyies the incremental changes since the last backup to existing backups. There are backup options which will create historical backups. –  BillThor Oct 10 '10 at 21:24

2 Answers 2

up vote 2 down vote accepted
DATE=`date +%m.%d.%Y`
rsync -razv dev@xx.xx.xx.xx:repos /home/backup_sys_user/repos_backup/$DATE

However, you might want to look at using --link-dest which will create backups with hardlinks, then, deleting older backups will still leave you with a full copy, but, you'll only take up the disk space for the changed files.

share|improve this answer
    
Thanks, that worked great. –  ant2009 Oct 10 '10 at 16:07
    
If this is only one command, you could just enter the date inline also rsync -razv dev@xx.xx.xx.xx:repos /home/backup_sys_user/repos_backup/$(/bin/date +%m.%d.%Y) –  Alex Oct 10 '10 at 17:21

karmawhore has it generally right, but instead of manually using "--link-dest", you may want to check out rsnapshot:

http://rsnapshot.org/

Also, for large numbers of files I'd recommend using a version of rsync in the 3.x range because of this key improvement:

- A new incremental-recursion algorithm is now used when rsync is talking
  to another 3.x version.  This starts the transfer going more quickly
  (before all the files have been found), and requires much less memory.
  See the --recursive option in the manpage for some restrictions.
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.