DEV Community

Urban
Urban

Posted on

nas-sync-script-builder generates a bash script for one-way, no-deletion NAS sync using rsync and lsyncd

nas-sync-script-builder: a small tool for a very specific NAS problem

Most backup and sync tools assume one of two models:

  • Mirroring: source and destination must be identical
  • Backup systems: versioned, snapshot-based, or cloud-oriented

There is a common use case that falls between these models and is poorly served by existing tools:

Keep a NAS continuously updated from a local machine, one-way, while preserving existing files on the NAS.

This is the problem nas-sync-script-builder exists to solve.


The niche it fills

The target scenario:

  • A Linux workstation or server
  • One or more local disks (often NTFS or mixed filesystems)
  • A NAS (Synology or any SMB-compatible device) as a sink
  • Files flow local → NAS only
  • Existing NAS files remain untouched

Many tools approximate this behavior, but none provide it directly:

  • rsync requires careful flag management
  • lsyncd is powerful but tricky to configure
  • Backup tools (Borg, Restic, Duplicati) are versioned or snapshot-based
  • NAS vendor tools enforce mirroring or proprietary agents

What’s missing is a safe, repeatable way to set up:

  • Incremental initial sync
  • Continuous real-time sync
  • Systemd-aware mounts
  • Persistent credentials

How it works

nas-sync-script-builder is a configuration generator, not a daemon.

It provides:

  • A Python GUI (and optional CLI) for configuration
  • Automatic detection of eligible local partitions via UDisks2
  • A generated Bash script that:
  1. Installs required packages (rsync, lsyncd, cifs-utils)
  2. Creates local and NAS mount points
  3. Configures CIFS mounts using systemd automounts
  4. Writes a managed /etc/fstab block
  5. Performs an initial one-way sync with rsync
  6. Configures lsyncd for continuous updates
  7. Handles systemd dependencies, logs, and inotify limits
  8. Is safe to re-run at any time

The Python tool exists to make this setup explicit, reviewable, and reproducible.


Who this is for

  • Linux users with a NAS needing continuous updates
  • Users migrating from Windows disks to a NAS
  • Anyone who wants controlled, append-only sync without snapshot or backup tools

Project links

Top comments (0)