Efficient rsync transfers for Australian Linux systems
rsync compares directory trees and transfers the data needed to update a destination, rather than sending every file again. On RHEL, CentOS and Fedora hosts, it is a practical choice for web assets, application data, configuration backups and replication between Australian sites.
Remote copies commonly run over SSH, combining rsync with encrypted transport, key-based authentication and useful exit codes. The same pattern can move data between a Melbourne office, a Sydney cloud region or a branch appliance in Perth.
The efficiency comes with risk: a mistaken path or unsafe deletion option can damage production data. A dry run, narrow exclusions, retained snapshots and a tested restore make routine synchronisation predictable.
Preparing the Linux endpoints
Install rsync on both endpoints with sudo dnf install rsync (sudo yum install rsync on older CentOS), then confirm the remote copy using ssh deploy@sydney-01 'rsync --version'. Give automation a dedicated SSH key and restricted account rather than sharing root credentials.
Test the route with a small directory and check latency and packet loss, particularly where a Perth branch reaches a cloud region through business NBN or Fibre. Australian data-residency requirements may also require both systems to remain in-country. For an auditable setup session, the Sakis3g terminal recorder can preserve the commands and output.
Building a safe remote copy
Begin with a dry run that lists planned changes without modifying the destination. The trailing slash on /srv/app/ means copy the directory’s contents, while omitting it would create another app directory.
rsync -aH --info=progress2 --dry-run --itemize-changes \
--exclude='.cache/' /srv/app/ deploy@sydney-01:/srv/app/
Review every proposed deletion and exclusion, then repeat without --dry-run. Add --partial-dir=.rsync-partial so an interrupted transfer can resume, and use --delete-delay only when the destination must mirror a defined source tree.
For a custom SSH port, append -e 'ssh -p 2222'. Test -z compression on the actual link; it can reduce traffic between distant sites, but may be unnecessary over metro fibre and can increase CPU use.
Comparing transfer methods
The transport and retention model should match the workload, the network boundary and the required recovery history.
| Method | Best fit | Main advantage | Main trade-off |
|---|---|---|---|
rsync over SSH |
Ad hoc and scheduled directory copies | Encryption and familiar remote administration | Requires rsync and SSH at both ends |
rsync daemon |
Repeated transfers between trusted hosts | Efficient multi-client access | Adds daemon configuration and network exposure |
scp |
Small, one-off file copies | Minimal setup | No directory synchronisation or delta transfer |
rsync --link-dest |
Versioned remote snapshots | Reuses unchanged files and preserves history | Requires deliberate storage and retention planning |
For most Australian administrators, rsync over SSH is the sensible default because it works across public, private and hybrid infrastructure without opening another daemon. For nightly versioned copies, combine it with --link-dest=/srv/snapshots/previous so unchanged files can be hard-linked into a new snapshot. Use the daemon only for controlled private-network workloads, with suitable authentication and monitoring.
Protecting data during each run
Use a restricted service account and a named SSH key; never place a password in a cron file. Confirm host keys during provisioning. Add -AX only when ACLs or extended attributes must survive and both endpoints have the required privileges. A trusted network path still benefits from SSH because it provides encryption and a clear audit trail.
Pair any future --delete with --delete-delay and a conservative --max-delete limit, while retaining a snapshot outside the synchronised tree. Compare file checksums on a sample after each major release. Scheduling matters locally: daylight-saving changes shift clocks between AEST and AEDT, so use an explicit timedatectl timezone rather than relying on an unqualified cron time.
Building a repeatable operating checklist
A short, documented routine reduces mistakes during routine jobs and emergency copies:
- Confirm source and destination paths, including trailing-slash semantics, against a written inventory.
- Run every new job first with
--dry-run --itemize-changesand review all proposed deletions. - Restrict the service account to the required directories and rotate SSH keys on a defined schedule.
- Enable
--partial-dir=.rsync-partialto support resumable transfers. - Log standard output and standard error, capture rsync’s exit status, and alert on non-zero results.
- Match the schedule to the site’s low-demand period and monitor NBN or Fibre congestion.
- Test restoration from a snapshot before relying on the job for disaster recovery.
Exit status 23 usually indicates a partial transfer, while 24 can report files that vanished during deletion; both deserve investigation. If rsync or SSH compression competes with production services, diagnosing CPU pressure can reveal whether scheduling or compression tuning is appropriate.
Finalising the first production transfer
Once the dry run is clean, perform the initial full copy during a maintenance window, then enable incremental runs through a systemd timer or cron. Keep credentials outside the command file, use absolute paths, and confirm that the destination has enough free space for temporary files. Record the first successful run’s duration and bandwidth so later changes have a useful baseline.
The next concrete step is to run rsync -aH --dry-run --itemize-changes /srv/app/ deploy@sydney-01:/srv/app/ on the source host and retain the output for review.