franks hub / projects / nas-sync

Overview

A local copy of a private OneDrive on a QNAP NAS at home. The NAS collects the data on its own every night with rclone, so no PC has to be running. Traffic goes one way only: from the cloud to the NAS.

A sync on its own is not a backup — if a file disappears in OneDrive, a plain mirror deletes it too. So nothing is thrown away here: whatever is deleted or overwritten in the cloud is moved into a dated version folder on the NAS.

OneDrivePersonal Microsoft account, about 24 GB
rclone on the QNAPcron job, nightly at 02:30, throttled
OneDrive-Backupcurrent/ + versions/
Windows Explorervisible as a network share
Private project QNAP NAS rclone cron Set up Sep 2026

Setup

Addresses and user names are placeholders. Folder names are shown in English here; on the NAS they are German (aktuell, versionen).

  1. Get rclone onto the NAS

    The NAS cannot download it itself — its certificate store is too old for today’s HTTPS. So the ARM build is downloaded on the PC, copied to /share/Public/rclone/ with scp and made executable. Below, rclone is short for that full path.

  2. Sign in to OneDrive on the Windows PC

    The Microsoft login needs a browser, so rclone config runs on Windows: remote name onedrive, type OneDrive Personal. Quick check:

    .\rclone.exe lsd onedrive:
  3. Copy the finished config to the NAS

    scp "$env:APPDATA\rclone\rclone.conf" <user>@<nas-ip>:/root/.config/rclone/rclone.conf

    On the NAS, rclone lsd onedrive: now lists the top-level OneDrive folders.

  4. Create target folders and do a dry run

    mkdir -p /share/CACHEDEV1_DATA/OneDrive-Backup/current /share/CACHEDEV1_DATA/OneDrive-Backup/versions
    rclone sync onedrive: /share/CACHEDEV1_DATA/OneDrive-Backup/current --dry-run --max-depth 2
  5. Start the first full sync in the background

    setsid keeps it alive after the SSH window closes; the flags keep it inside the 1 GB of RAM the NAS has.

    setsid rclone sync onedrive: /share/CACHEDEV1_DATA/OneDrive-Backup/current \
      --backup-dir /share/CACHEDEV1_DATA/OneDrive-Backup/versions/$(date +%Y-%m-%d) \
      --transfers 1 --checkers 1 --tpslimit 5 --buffer-size 0 --use-mmap --no-traverse \
      --log-file /share/CACHEDEV1_DATA/OneDrive-Backup/rclone.log --log-level INFO \
      < /dev/null > /dev/null 2>&1 &
  6. Schedule the nightly job

    On QNAP the entry has to live in /etc/config/crontab — anything added with crontab -e is gone after the next reboot.

    crontab /etc/config/crontab
    /etc/init.d/crond.sh restart
  7. Make it visible in Windows

    In QTS, create a shared folder OneDrive-Backup and point it at the existing folder via “enter folder path manually”. It then shows up in Explorer under \\<nas-ip>\OneDrive-Backup.

Schedule

02:30

Every night via cron. Moving it to 04:30 is under consideration, so a long run can never overlap with the next one — two rclone processes at once are too much for 1 GB of RAM.

--transfers 1--checkers 1--tpslimit 5--buffer-size 0--use-mmap--no-traverse

The cron line — note that % has to be escaped as \% inside a crontab:

30 2 * * * rclone sync onedrive: /share/CACHEDEV1_DATA/OneDrive-Backup/current --backup-dir /share/CACHEDEV1_DATA/OneDrive-Backup/versions/$(date +\%Y-\%m-\%d) --transfers 1 --checkers 1 --tpslimit 5 --buffer-size 0 --use-mmap --no-traverse --log-file /share/CACHEDEV1_DATA/OneDrive-Backup/rclone.log --log-level INFO

Folders

/share/CACHEDEV1_DATA/OneDrive-Backup/ # QTS share "OneDrive-Backup" ├── current/ # 1:1 mirror of OneDrive ├── versions/ │ └── YYYY-MM-DD/ # files deleted or overwritten in that run └── rclone.log # log of every run /root/.config/rclone/rclone.conf # OneDrive login token /etc/config/crontab # schedule, survives reboots

versions/ stays empty after the first run and starts filling from the second one on.

Lessons learned

ProblemCauseFix
QNAP’s own backup app (HBS 3) fails with “system error”The Microsoft login never makes it back to the NAS — most likely the old firmwareDropped HBS 3, switched to rclone
NAS cannot download rcloneOutdated certificate store rejects modern HTTPS sitesDownload on the PC, copy with scp
rclone config fails on the NASNo browser for the login, long tokens can’t be pasted into the terminalConfigure on Windows, copy the finished rclone.conf
Sync dies shortly after startingDefault settings need more RAM than 1 GB; nohup doesn’t reliably keep it alivesetsid plus throttled flags — now runs steadily at about 76 MB
Cron job would vanish on rebootQNAP rewrites the crontab at bootEntry in /etc/config/crontab
Backup invisible on the networkA folder created over SSH is not a QTS shareShared folder with a manually set path

Status

Done

  • rclone runs on the NAS and reads OneDrive
  • First full sync (about 24 GB) started, roughly 6–8 hours
  • Nightly job scheduled with throttled settings
  • Backup visible in Windows Explorer

Open

  • Check the log after the first nightly run
  • Decide between 02:30 and 04:30
  • Set the share to read-only for the everyday user
  • Switch SSH off once nothing needs adjusting
  • Look for a firmware update for the NAS
  • As long as the job runs regularly, rclone renews the OneDrive token by itself. After a long pause or a password change: run rclone config reconnect onedrive: on the PC and copy the config to the NAS again.