LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Rsync backups and delete (http://www.linuxquestions.org/questions/slackware-14/rsync-backups-and-delete-4175461360/)

andy713 05-09-2013 08:48 PM

Rsync backups and delete
 
My system has two drives, one system and one for backups. I got to test my backups this week when my system drive died. The good news is I'm back on current again, and I had all my files. And more. I'd been using rsync in a cron job with the --archive --backup --suffix=~`date +%Y%m%d` options, so after restoring getting rid of the prior versions was easy enough. But as it turns out, what doesn't happen is when a file is moved or deleted the destination copy isn't tagged with the suffix. Now I have to redelete them, which doesn't sound bad until you get to the maildirs. Any ideas on how I can solve this problem going forward, keeping my current scheme relatively intact?

Andy

qweasd 05-10-2013 06:52 AM

This is not a Slackware question.

Looks like you are screwed, since you lost information. If you wanted to restore like that, you could have used --delete (or --delete-excluded if your exclusion list keeps changing). As it stands, you have polluted the "backup". It's not really backup, what you are doing, you know? At no point do you have an option of rolling back to any particular date in the past. If you want backup, you need to rsync with --delete or into an empty dir, checksum that baby, and freeze it forever. What you are doing is a "dirty mirror" of sorts.

granth 05-10-2013 03:56 PM

You should take a look at rsnapshot. It uses rsync to create incremental backups, which is a much better approach.

AlvaroG 05-10-2013 05:02 PM

Quote:

Originally Posted by andy713 (Post 4948228)
My system has two drives, one system and one for backups. I got to test my backups this week when my system drive died. The good news is I'm back on current again, and I had all my files. And more. I'd been using rsync in a cron job with the --archive --backup --suffix=~`date +%Y%m%d` options, so after restoring getting rid of the prior versions was easy enough. But as it turns out, what doesn't happen is when a file is moved or deleted the destination copy isn't tagged with the suffix. Now I have to redelete them, which doesn't sound bad until you get to the maildirs. Any ideas on how I can solve this problem going forward, keeping my current scheme relatively intact?

Andy

I got the same issue with rsync, I had the --delete in place, but somehow the mirror I was creating was still having deleted files. I re-created the copy from scratch, and it has been behaving correctly since then.
Quote:

Originally Posted by granth (Post 4948757)
You should take a look at rsnapshot. It uses rsync to create incremental backups, which is a much better approach.

+1 to rsnapshot. Incremental + rotating backups with a simple command, and based on rsync.

GazL 05-10-2013 06:32 PM

I use gnu/tar's listed-incremental mode myself.


All times are GMT -5. The time now is 08:31 AM.