[clug] note on restoring incremental backups using rsync write-batch was Re: rsync question

Steve Jenkin sjenkin at canb.auug.org.au
Sun Apr 3 03:10:50 UTC 2016


I want to backup partition images to an external disk, but wish to reduce the space used and only store incrementals.

The ‘usual way’ this is done, such as with dump, is to create & keep a (full) base-image and store differences from this, as either successive incrementals, where Base + inc[1] +inc[2] … +inc[n] recovers to point-in-time of ‘nth’  backup, or ‘differential’ which is Base + diff[n], trading space and speed.

I wish to always keep the latest full backup and store incrementals back in time, the opposite order used with dump ‘incrementals'.
Below are the command-line snippets I used to achieve that.
I have two full backups of a partition, one from 2016-03-14 and the next from 2016-03-30, each 30GB [its an old machine].

bzip2 compressed down to 16GB. The incremental was 1.8GB, so it was worthwhile exercise.

Two things I didn’t understand using rsync in this way:

	- it’s NOT ‘rsync --write-batch=delta From To’ 
		it’s  ‘rsync --write-batch=delta To From’
		in my case: ‘rsync --write-batch=delta Older Newer’, which I found counter-intuitive [but makes sense in this context]

	- the recovered filename will be the same, the existing full backup will be overwritten, not the ‘recovery’ I was wanting.
		ie ‘rsync --read-batch=delta Newer’ overwrites the current full backup with the previous (use ‘-b’ to preserve orig file)
		using ‘-b’, I need two renames after a recovery.  (Newer- > Older, Newer-bkup -> Newer)

I’ve yet to find how to farnarkle rsync parameters to avoid those last two renames.
Any suggestions welcomed.

cheers
steve


## create delta file, from 30th back to 14th
sudo rsync -v --only-write-batch=sda1_2016-03-30_2016-03-14.inc /media/SJ-209G/T43/sda1-2016-03-14.img  /media/SJ-209G/T43/sda1-2016-03-30.img 

## recreate 14th, leaving file named (incorrectly) 30th
## -b option to not overwrite original, keep a 'backup’
sudo rsync -v -b --read-batch=sda1_2016-03-30_2016-03-14.inc ${1:-/media/SJ-209G/T43/sda1-2016-03-30.img}



> On 31 Mar 2016, at 3:25 PM, steve jenkin <sjenkin at canb.auug.org.au> wrote:
> 
> Recovery is simple:
> 	rsync --read-batch=foo source-file destination-file
> 
> as in:
> 	rsync --only-write-batch=foo source-file destination-file
> 

--
Steve Jenkin, IT Systems and Design 
0412 786 915 (+61 412 786 915)
PO Box 48, Kippax ACT 2615, AUSTRALIA

mailto:sjenkin at canb.auug.org.au http://members.tip.net.au/~sjenkin




More information about the linux mailing list