rsync slow exclude folder

Francis.Montagnac at inria.fr Francis.Montagnac at inria.fr
Sat Feb 28 08:39:13 MST 2015


Hi

On Sat, 28 Feb 2015 06:41:59 +0300 Дугин Сергей wrote:

> rsync -a --exclude="tmp/*" /home/ /backup/home/

> If the folder /home/tmp/ is many millions of files, rsync
> think of this folder can be seen through the lsof -p PID

Or strace yes. It seems that rsync does an lstat for any file before
applying the exclude rules.

Possible optimisation?

> If you do so: rsync -a --exclude="tmp/" /home/ /backup/home/
> then backup is done very quickly, but tmp folder in the backup does not
> will be created.

> How to make so that rsync long thought over such folders, but
> This created a backup of them empty?

Since the backup with --exclude="tmp/" is fast it may be acceptable to
make two passes, one for the main stuff, the second to populate the
tmp/ directories.

Example:

  rsync -a --delete --exclude='tmp/' --filter='protect tmp/' /home/ /backup/home
  (cd /home && find . -name tmp -prune -print ) \
      | rsync -a --files-from - /home/ /backup/home

Francis
-- 


More information about the rsync mailing list