Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
network backups with rsync, keep deleted files?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
Telexen
Apprentice
Apprentice


Joined: 09 Oct 2005
Posts: 189

PostPosted: Wed Sep 05, 2007 7:48 am    Post subject: network backups with rsync, keep deleted files? Reply with quote

I'm going to use rsync to make regular syncs of a drive in my workstation to my server, so obviously the two drives will be kept identical just in case.

I've got that setup and working well, but I'd like to be able to have rsync automatically copy any files that are to be deleted from the backup to another folder on another drive (because I deleted/renamed/whatever them from my workstation). I've checked out the manpage, and a few options stuck out at me:

Code:

       -b, --backup
              With this option, preexisting destination files are renamed as each file is trans-
              ferred or deleted.  You can control where the backup file goes and what  (if  any)
              suffix gets appended using the --backup-dir and --suffix options.

              Note  that if you don't specify --backup-dir, (1) the --omit-dir-times option will
              be implied, and (2) if --delete is also  in  effect  (without  --delete-excluded),
              rsync  will  add  a  "protect" filter-rule for the backup suffix to the end of all
              your existing excludes (e.g. -f "P *~").  This will prevent  previously  backed-up
              files  from  being deleted.  Note that if you are supplying your own filter rules,
              you may need to manually insert your own exclude/protect rule somewhere higher  up
              in  the  list so that it has a high enough priority to be effective (e.g., if your
              rules specify a trailing inclusion/exclusion of '*',  the  auto-added  rule  would
              never be reached).

       --backup-dir=DIR
              In  combination with the --backup option, this tells rsync to store all backups in
              the specified directory on the receiving side.  This can be used  for  incremental
              backups.   You  can additionally specify a backup suffix using the --suffix option
              (otherwise the files backed up in the specified directory will keep their original
              filenames).


I hoped this option was what I wanted and tried to use it by setting the -b flag then using '--backup-dir=/home/telexen/deleted-backups', but it didn't seem to do anything at all. Am I using it wrong or did I just interpret the description wrong? Is there another option that will allow me to do this?

*edit*
I just realized this got put in Unsupported Software...I meant to put it in Other Things Gentoo. Maybe a mod could move it for me if it seems out of place?
Back to top
View user's profile Send private message
Telexen
Apprentice
Apprentice


Joined: 09 Oct 2005
Posts: 189

PostPosted: Thu Sep 06, 2007 3:19 pm    Post subject: Reply with quote

Bump (first and last)
Back to top
View user's profile Send private message
Telexen
Apprentice
Apprentice


Joined: 09 Oct 2005
Posts: 189

PostPosted: Thu Sep 06, 2007 6:25 pm    Post subject: Reply with quote

Heh...I guess I wasn't using --delete when I was testing the functionality of --backup and --backup-dir=...

Works fine when I use --delete.

Oh well.
Back to top
View user's profile Send private message
ferg
Guru
Guru


Joined: 15 Nov 2002
Posts: 536
Location: Cambridge, UK

PostPosted: Wed Sep 19, 2007 10:15 am    Post subject: Reply with quote

Hi Telexen,

I never realised Rsync could do that. I rsync between my Mac laptop and my Gentoo box with a nightly cron job. I use a non delete script , and another manually run script with delete. Obviously I end up with duplicates, but I'd hate to lose files as i do use both boxes regularly. This would be a very useful modification!!

Nice one.

Cheers
Ferg
_________________
Climb up it, kayak down it + make sure it runs on GNU/Linux
"cease to exist, giving my goodbye, drive my car into the ocean,
you think I'm dead, but i sail away, on a wave of mutilation!"
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum