From QNAPedia
Revision as of 04:10, 30 June 2015 by Admin (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


rsync is a great tool for doing syncs of two folders on a local filesystem or a combination of local and remote filesystems. It operates at the file level, but uses a neat algorithm that detects only the changed parts of files and only sends those changes to the other side. In essence it sends the instructions required to turn the remote file into the local version. Most tools send the entire file if even just single bit changes.


rsync -av /source/directory/or/file /destination/directory/or/file

For example, to sync an external USB drive to your Multimedia share

rsync -avL /share/USBDrive1/movies /share/Multimedia

which will create a directory called movies in /share/Multimedia

The -L option is required to force rsync to follow the symlink /share/<sharename> to the actual directory with the data.

Generic Automated Off-site Backup

By design, the current rsync server options in the QNAP WebUI do not allow you to replicate data to a generic SSH server with rsync installed, which is a great feature sadly lacking on the QNAP.

However, since the QNAP has SSH and rsync already installed, you can tie these together to provide the same functionality.

There are a couple of steps:

  1. Set up SSH keyfile login to the remote server
  2. Test on a small directory
  3. Create a script to do the work and handle the gritty details (concurrent jobs, email notification)
  4. Add the script as a cron job
  5. Make things persistent across reboots and firmware upgrades

TODO: detailed steps here

Special Considerations

  • QNAP uses links to create the directories in /share/ that actually link to the real directories on /share/MDx_DATA where x is the RAID volume number, so you must use the -L option.
  • ACLs are not maintained on sync, only UNIX permissions
  • You should use the option --modify-window=2 when copying from FAT32 and NTFS because the granularity of Windows timestamping can be sloppy and you'll be unnecessarily analyzing files that really haven't changed.
  • The bandwidth throttling option in the QNAP version of rsync (--bwlimit=KBPS) does not appear to work. You must set up QoS on your router to make sure that the QNAP doesn't clobber your connection!
  • Be aware of the distinction between user@host::/path/directory (rsync native protocol on port 873) and user@host:/path/directory (rsync over SSH login on port 22).
  • Be aware of the need for trailing slashes when you don't want to copy the directory itself, only the contents
    • rsync /path/directory user@remotehost:/path/directory creates /path/directory/directory on the receiving side and copies all files.
    • rsync /path/directory/ user@remotehost:/path/directory just puts all of the files in /path/directory.