Limit the total bytes transfered?

Terry Dooher tdooher.lists at
Tue Mar 1 09:52:30 GMT 2005

Michael Best wrote:
> I ask because a client had a broken filesystem that occasionally has 2T+ 
> files on it (broken filesystem, so they weren't actually that big) but 
> we happily ran up a huge b/w bill with rsync.

For this specific example you could probably wildcard match the files with a 
--exclude= argument. Borked filesystems usually generate matchable files. For 
a more generic test:

if [ `du -sb <root>` -gt <size limit> ] ; then <barf>; else <rsync>; fi

Which is crude, time-consuming and won't transfer anything if you step even 
one byte over the limit. How evil do you want to be? :)

You could get your script to parse file-from before hand and maybe only backup 
  the entries that come in under the limit. Perhaps build the full file list 
yourself, incrementing a counter each file until you reach the size limit then 
fire off rsync with that new list passed to --files-from.

Again, not very elegant, but it'd do the job. This also assumes you're running 
something unixy (Doing this stuff in batch a whole new level of hell).

> -Mike

More information about the rsync mailing list