LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   network backups with rsync, keep deleted files somewhere else? (https://www.linuxquestions.org/questions/linux-server-73/network-backups-with-rsync-keep-deleted-files-somewhere-else-582519/)

Telexen 09-05-2007 08:28 PM

network backups with rsync, keep deleted files somewhere else?
 
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?

Telexen 09-06-2007 01:24 PM

erm.

Apparently I wasn't using --delete when I was testing to see if the backup option worked at all. Now that I try it with -b and --backup-dir=... it works fine.


All times are GMT -5. The time now is 03:27 PM.