Generating cpio list.

Dave Dykstra dwd at
Thu Oct 25 03:03:44 EST 2001

On Wed, Oct 24, 2001 at 07:30:59AM +0000, Thaddeus L. Olczyk wrote:
> One of the things I want to do besides mirror a hard drive is 
> maintain an incremental backup on tape.
> The way for me to do this ( of course ) is to take the
> output of rsync and use it to generate a list of files for cpio.
> The basic ideal is something like this
> declare -i head tail
> # gets the first line with total: at the begining
> head=$(grep -n ^total: $log_rsync|awk -F: '{print $1}') 
> head=$head-1
> # chop off first two lines
> tail=$head-2 
> head -n $head $log_rsync|tail -n $tail -|grep -v uptodate|cpio -o >
> /tape_device
> Is this a way of accurately generating the list of modified files?

[I assume your $rsync_log is made with -vv; you can probably get rid of
your grep -v uptodate if you used just -v].  I think that should work,
but note that rsync will print a file name any time it considers updating a
file, which is by default whenever the modification time has changed.  I'm
not sure if that's any better than just touching a special file whenever
you do an incremental update and using a find -cnewer <backup_time_file>
[available in GNU find] to find the list of files whose inodes have

> Also does it make sense to set the -a option of cpio ( it doesn't
> if rsync modifies the atime of the source files ).

Please, no.  As a user I have been burned several times by backup schemes
that have used cpio -a.  The -a option resets the access time of the input
file back to what it was, at the price of changing the inode time.  That
will mess up find -cnewer.

- Dave Dykstra

More information about the rsync mailing list