Site Overlay

QNAP with SMB

One of the biggest annoyance of with trying to backup a network drive with a QNAP, is you can only back up TO a network drive, not FROM one…. This defeats the point of a NAS for most people.

After several work arounds, I have found the best way to accomplish replication is to reply on the QNAP, but to use the computer that needs to be backed up. You can mount the QNAP shared folder in the fstab and then use rsync in a crontab.

These directions should work on any Linux system, and can be adapted to windows linux subsystem or even Mac OS.

First set up your shared folder on the QNAP. Set up a user/password for the folder or allow guest read/write access.

On the computer that need to be backed up, create the local folder for the mount.
$ mkdir /mnt/folder

Open up the fstab.
$ sudo nano /etc/fstab

At the end of the file add your mount. If you prefer, can use a credential filer rather than plain text user/pass.
//IP address/folder /mnt/folder cifs username=user,password=pass,uid=1000,iocharset=utf8 0 0

Save the file then refresh your mounts/
$ mount -a

Now set up a crontab to automate the backup.
$ sudo crontab -e

Add this line at the add:
09 21 * * */5 rsync -a –ignore-errors –delete /folder/to/be/backedup/ /mnt/folder

–ignore-errors is needed if the folder may have symlinks. Any errors will prevent deletions.
–delete to remove old files. Otherwise rsync will not propagate deletions.
09 21 * * */5 = Every 5th day at 21:09 the script runs.

For QNAP backups, I find this infinitely easier and much more reliable method of backup than anything else I have tried. Good luck.