QNAP: exclude files and directories from rsync

Posted by ads' corner on Tuesday, 2023-03-14
Posted in [Hardware]

I’m moving files from one QNAP system to another, and I’m using rsync for this. It’s preinstalled on a QNAP system. So far, so good.

To sync entire shared volumes, I want to exclude the @Recently-Snapshot and @Recycle entries - I don’t want to sync the trash bin and I also don’t want to sync entire snapshots.

The usual approach when using rsync is to just use the --exclude option.

1
rsync --exclude='@Recently-Snapshot' --exclude='@Recycle'

To my surprise this does not work. rsync on the QNAP does not complain, but also does not ignore the entries. Using escapes in front of the @ doesn’t work either. Ok, which version is the rsync program anyway?

1
2
3
[~] # rsync --version
rsync  version 3.0.7  protocol version 30
Copyright (C) 1996-2009 by Andrew Tridgell, Wayne Davison, and others.

Ouch, that is old. Very old. Released December 2009. Pretty sure QNAP did not fix all the bugs in there.

But according to the documentation, and the --help output, it accepts the --exclude option. Still not working though.

Ok, there is one more option: --exclude-from

I create a text file and add the two entries in there:

@Recently-Snapshot
@Recycle

And then I use the --exclude-from option to skip entries in these two directories:

1
rsync --exclude-from=/tmp/pattern.txt

This option works. At least something.

Summary

The rsync on a QNAP system does not accept the --exclude parameter, but the --exclude-from parameter works.

And for everyone asking why I don’t use the integrated file copy: this one skips certain files, but I also want my dot files copied over.


Categories: [Hardware]
Tags: [Backup] [Copy] [Nas] [Qnap] [Rsync]