For some reason, the ZyXEL NAS326 doesn’t ship with an rsync binary. This means you can’t copy files to it via rsync, which is really inconvenient.
Previously, you could install the RandomTools package, but the zyxel.diskstation.eu domain stopped working (however, the repository is alive and moved to a new address — more on that at the end of the article). So I had to figure out how to do it now.
Just a few commands combined into a script:
cat >/i-data/sysvol/install_rsync.sh <<EOF
curl -fLO http://entware.zyxmon.org/binaries/armv7/installer/entware_install.sh
chmod +x entware_install.sh
./entware_install.sh
/opt/bin/opkg install --force-space rsync
cp /opt/bin/rsync /bin
EOF
chmod 755 /i-data/sysvol/install_rsync.sh
Only after a reboot everything except the script disappears. You will need to repeat it:
/i-data/sysvol/install_rsync.sh
It’s probably possible to copy /opt to /i-data/sysvol/rsync/ and restore it from there without the Internet, but so far it hasn’t been needed.
You can’t just copy the single rsync binary, because it depends on many libraries (in theory, you could find a statically built binary somewhere that includes all libraries and doesn’t depend on external ones, but again, I don’t want to spend time on that yet — everything works and there are a lot of other things to do).
Update: how to make the installation survive a reboot
First, why everything disappears. The NAS326 root filesystem is a ramdisk image that the firmware unpacks from flash on every boot. /opt, /bin, /usr live inside it and are recreated on reboot. On the disks, only /i-data/* and /etc/zyxel survive a reboot. That’s why only the script survives, while Entware installed in /opt does not.
Option 1: MetaRepository + RandomTools (the proper way)
The zyxel.diskstation.eu domain is indeed dead, but the repository itself moved to a new address: http://zyxel.ddnss.eu/Users/Mijzelf/zypkg-repo/. Important: it must be http, without the s — the curl in the firmware supports neither https nor redirects, and the package list simply won’t download.
cd /i-data/sysvol/admin
mkdir -p zy-pkgs && cd zy-pkgs
echo "http://zyxel.ddnss.eu/Users/Mijzelf/zypkg-repo/" > web_prefix
Then in the web interface: App Center → Browse → All Apps → refresh the list → install MetaRepository → refresh the list again → install RandomTools (rsync is included in it; the package has no web interface, that’s normal).
Why this survives a reboot: packages installed through the stock package manager physically live in /i-data/sysvol/.PKG/<name>/ — that is, on the disks — and the firmware runs their startup scripts at boot.
If you need rsync as a daemon (to receive backups over the rsync protocol), autostart is done via a script in /i-data/sysvol/.PKG/RandomTools/etc/custom_startscripts/ — the firmware executes everything from this folder at boot:
cat >/i-data/sysvol/.PKG/RandomTools/etc/custom_startscripts/rsyncd.sh <<EOF
#!/bin/sh
/usr/local/bin/rsync --daemon --config=/opt/etc/rsyncd.conf
EOF
chmod +x /i-data/sysvol/.PKG/RandomTools/etc/custom_startscripts/rsyncd.sh
(check the binary path with which rsync; if Backup Planner is installed — remove it, its zysync occupies port 873).
Option 2: stick with the manual installation from the script above
The idea: put the Entware body on the disk, and after a reboot restore only the symlink and start the daemon — without the Internet and without reinstalling.
Once, after a successful installation:
cp -a /opt /i-data/sysvol/opt-persist
rm -rf /opt
ln -s /i-data/sysvol/opt-persist /opt
The restore script /i-data/sysvol/rsync_boot.sh:
#!/bin/sh
# restore /opt if a reboot wiped it
[ -e /opt/bin/rsync ] || { rm -rf /opt; ln -s /i-data/sysvol/opt-persist /opt; }
# start rsyncd if it's not running yet
pidof rsync >/dev/null || /opt/bin/rsync --daemon --config=/i-data/sysvol/opt-persist/etc/rsyncd.conf
The problem: on stock firmware without MetaRepository there is no autostart hook — nothing runs this script at boot. So the trigger is made from the outside, from the device that initiates the backups (in my case, TrueNAS): a cron job a couple of minutes before the backup window:
sshpass -p 'root_password' ssh -o StrictHostKeyChecking=no root@<NAS326_IP> /i-data/sysvol/rsync_boot.sh
NAS reboots are rare, and if one happens — the next backup job will bring everything back up by itself.