FTPRemoteSync
An incremental Raspberry Pi backup that nightly pulls only the changed files from a remote (FTP-exposed) NAS and stores them on a local NAS.
The goal
Keep a safety copy of the data on a NAS that lives at another location, saving it automatically onto a local NAS. The idea is an off-site backup with no manual work, transferring only what has actually changed each time.
How it works
A small Raspberry Pi sits between the two NASes:
- It mounts the local NAS (over CIFS/SMB or NFS) as a system folder.
- It connects to the remote NAS over FTP and, using
lftp mirror, downloads only the files that are new or changed since the last run (--only-newer), in parallel. - It runs every night via cron and writes one log per run, with automatic rotation.
The remote NAS sits behind a home connection with no reachable public IP: the two sites are linked by a private site-to-site VPN, so the Pi can reach it as if it were on the local network.
Configuration
All behaviour lives in a single JSON file: the list of folders to copy (each entry
maps a remote path to a local one), the number of parallel transfers, and how many days
of logs to keep. The NAS and FTP credentials live in separate, root-only files
(mode 600), kept out of the config.
Design choices
- Genuinely incremental:
lftpcompares timestamps and skips what’s already up to date — after the first copy, each night moves very little. - Boot resilience: the local NAS mount uses
_netdevandnofail, so the Pi still boots if the NAS is momentarily offline. - Parallel transfers tuned for a Pi 3 (with room to dial them down if it struggles).
- Dry-run to verify paths before a real copy, and logrotate keeping ~15 days of compressed logs.
Stack
Raspberry Pi · Bash · lftp · cron · CIFS/NFS · logrotate · jq