[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [rdiff-backup-users] Incremental Restore

From: Edward Ned Harvey
Subject: Re: [rdiff-backup-users] Incremental Restore
Date: Mon, 6 May 2013 10:54:45 -0400

> From: rdiff-backup-users-bounces+rdiff-
> address@hidden [mailto:rdiff-backup-users-
> address@hidden On Behalf Of Kosta
> I'm currently trying to move from a "incremental rdiff-backup on same
> filesystem" to "modern filesystem with snapshots".

Out of curiosity, what are you moving to?

> 1. Restore full backup of oldest existing version from $backup to $new
> 2. Take a snapshot of $new
> 2. For each increment:
> 2.1. List all changed/added files using:

There is probably a faster and less space way to do this, but I would do
something like this:  Because it's super easy and reliable.

First get the list of all increments.
        rdiff-backup -l /rdiff-backup-dir | grep increments | sed
's/.*increments.//' | sed 's/.dir.*//'

Also get the timestamp of the "current" one:
        ls /rdiff-backup-dir/rdiff-backup-data/current_*

Stick all these into a variable to be iterated over.  (Hopefully not TOO
many, so you don't exceed maximum command length and stuff like that.
Otherwise you'll have to use something like xargs, or multiple commands, to
iterate differently, which could get a little more complicated.)
        export INCREMENTS="2013-05-06T13:55:24Z 2013-05-06T13:55:46Z

Be sure to include the current, latest timestamp in that list, as the final
argument.  And be sure they're sorted chronologically.

Now, before I continue, I'm assuming your destination is zfs or btrfs or
something.  So you DON'T want to overwrite files in the destination that
haven't changed.  Unfortunately, the behavior of rdiff-backup restoration is
to overwrite the destination you're restoring to.  So you'll have to restore
to an intermediate directory instead, and then use something like rsync to
stage the *actual* changes to the *actual* destination directory.  Using
rsync, it will choose based on timestamp and other file properties, not to
overwrite files that appear to be the unchanged.  Thus achieving the end
result you desire, unless for some reason, timestamp and those other
properties are inaccurate indicators of file changes in your environment.
(For most environments, this is a safe assumption.)

for INC in $INCREMENTS ; do 
        echo $INC
        rdiff-backup --force -r $INC /rdiff-backup-dir/ /tmp/staging/
        rsync -a /tmp/staging/ /destination
        rm -rf /tmp/staging
        # Optionally, "zfs snapshot" or "btrfs snapshot" /destination

reply via email to

[Prev in Thread] Current Thread [Next in Thread]