October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk10 min

How to Use rsync to Back Up and Sync Files Between Servers Safely

A practical rsync guide for server-to-server backups: prepare SSH access, understand trailing slashes, preview every change, choose between backup and mirror behavior, and validate restores.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use rsync over SSH to copy only the files that are new or changed, while preserving the source tree and its metadata. The safest workflow is to prepare both servers, run an identical command with --dry-run, inspect the planned transfers or deletions, and only then run the real command. Use archive mode (-a) for ordinary backups, add --delete only when you intentionally want a mirror, and use --backup-dir when replaced destination files must remain recoverable.

What rsync does—and what it does not do

rsync compares a source directory tree with a destination tree. It transfers files that are missing or have changed instead of retransmitting every unchanged file. That makes repeated backups faster and reduces bandwidth compared with copying the whole directory each time.

As an Amazon Associate I earn from qualifying purchases.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A transfer has a direction. In a push, the server holding the source starts rsync and writes to a backup server. In a pull, the backup server starts rsync and reads from the source. The remote side is commonly reached through SSH, so the connection uses the SSH account’s authentication, host-key checking and permissions.

rsync is a synchronization utility, not automatically a versioned or immutable backup system. A normal run can replace a destination file. A run with --delete can remove destination-only files. A run with --remove-source-files can remove source files after transfer. Decide which behavior you need before writing the scheduled command.

#1 Best Overall
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400) | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
  • Easily store and access 2TB to content on the go with the Seagate Portable Drive, a USB external hard drive
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Prepare both servers

Install and identify the endpoints

Install the rsync package on both hosts with each operating system’s package manager. Confirm the exact source hostname, destination hostname, and absolute paths you will use. Relative paths make an already-dangerous synchronization harder to audit.

Create the destination directory before the first transfer. Its owner, group, mode and available storage must suit the account that will run rsync. Check free space, quotas and inode availability, not only the apparent size of the data.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Test SSH independently

From the host that will initiate the job, log in to the other host with the intended account. Verify the host key when it is first presented, then confirm that the account can read every source path needed for a pull or write every destination path needed for a push.

Use a dedicated account with access limited to the required paths. A backup key should not grant unrestricted administrative access when a narrower account and directory ownership are sufficient. Test the account’s permissions before scheduling rsync; a successful SSH login does not prove that rsync can read or write the complete tree.

Understand archive mode and the trailing slash

Why -a is the normal starting point

-a, or --archive, enables recursive copying and the usual preservation set: -rlptgoD. In practical terms, it preserves the directory structure and common file metadata such as permissions, modification times, ownership, groups and device or special-file information when the account has the authority to do so.

Archive mode is a baseline, not a promise that every property of every filesystem is captured. Confirm that the account can preserve the metadata you care about, and decide separately whether attributes such as ACLs, extended attributes, hard links or filesystem snapshots are required by your workload.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The slash changes the result

These two source forms are different:

  • /srv/data/ means “copy the contents of data.” Files appear directly under the destination directory.
  • /srv/data means “copy the directory named data.” The destination normally receives a data directory beneath the path you specify.

Write both paths explicitly in your runbook. Most backup examples use a trailing slash when the destination directory is already named and should receive the source contents.

Rank #2
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
  • Easily store and access 5TB of content on the go with the Seagate portable drive, a USB external hard Drive
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Push a backup from the source server

1. Preview the transfer

Run this on the server containing the data:

rsync -a -n -v -e ssh /srv/data/ [email protected]:/srv/backups/data/

-n is the short form of --dry-run. It performs a trial run that does not make changes. -v displays more transfer information, which makes the first review easier. -e ssh explicitly selects SSH as the remote-shell transport; it can be omitted when SSH is already the default and no custom SSH options are needed.

Read the complete file list. Confirm that the remote hostname, account and destination are correct, and check that the slash after /srv/data/ gives the layout you intended. Save the preview output to a log when this is a production job.

2. Execute only after reviewing

When the dry run shows the expected files and no unintended path, run the same command without -n:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
rsync -a -v -e ssh /srv/data/ [email protected]:/srv/backups/data/

Keeping every other option identical makes the preview meaningful. A later change to the source, destination, exclusions or deletion policy requires another dry run.

3. Verify the result

Check the command’s exit status and inspect the destination. For important data, run a follow-up dry run in the same direction; an empty or expected change list indicates that the trees now agree under the selected rules. This is a consistency check, not a restore test.

Pull a backup from the source server

A pull is useful when the backup host should control the schedule and the source should accept only read access. Run the following on the backup server:

Preview

rsync -a -n -v -e ssh [email protected]:/srv/data/ /srv/backups/data/

Run after inspection

rsync -a -v -e ssh [email protected]:/srv/data/ /srv/backups/data/

Here the remote source ends in /srv/data/, so its contents are copied into the local /srv/backups/data/ directory. Test both remote read access and local write access before placing this command in a scheduler. Restrict sourceuser to the source paths it must expose.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
  • Easily store and access 1TB to content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop. Reformatting may be required for Mac
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Make a destination a true mirror

What --delete changes

Without --delete, rsync updates or adds files but normally leaves destination-only files in place. With --delete, it removes files from the destination when they are absent from the source within the directories being synchronized. That is a mirror policy, not merely a faster backup.

The rsync manual warns: “This option can be dangerous if used incorrectly!” A typo in the source path, an empty mount, a wrong hostname or an over-broad destination can therefore turn a routine job into mass deletion.

Preview every deletion

rsync -a -n -v --delete -e ssh /srv/data/ [email protected]:/srv/backups/data/

Do not remove -n until every planned deletion is understood. Verify the absolute paths and mount points on both hosts, then run the identical command without -n:

rsync -a -v --delete -e ssh /srv/data/ [email protected]:/srv/backups/data/

Account for exclusions

Filters affect the file set that rsync considers. Excluded files are normally protected from deletion; deleting excluded files requires explicitly enabling that behavior. Review include and exclude rules together with the dry-run output, because a filter that hides a file from the transfer can also make your intended mirror boundary unclear.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep replaced destination files for rollback

Use --backup and --backup-dir

When a destination file is about to be replaced or deleted, --backup renames the pre-existing file instead of discarding it. --backup-dir places those copies in a separate directory:

rsync -a -n -v --backup --backup-dir=/srv/backups/changed/ -e ssh 
  /srv/data/ [email protected]:/srv/backups/data/

Preview this command first. Once the backup directory and file list are correct, remove -n for the real run. The rsync manual describes the behavior precisely: “With this option, preexisting destination files are renamed as each file is transferred or deleted.”

These retained copies provide a rollback opportunity for changed files, but they are not a complete snapshot or immutable backup system. They can consume storage, can be altered by later access to the backup host, and do not by themselves establish a tested point-in-time restore.

Rank #4
Seagate Portable 4TB External Hard Drive HDD – USB 3.0, 1-Year Rescue | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
  • Easily store and access 4TB of content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Control which files are synchronized

Start with the narrowest path

The safest scope is an explicit source directory whose contents are intended for the destination. Do not point a destructive command at a broad parent directory merely to avoid listing several paths. Separate jobs make their deletion boundaries easier to review.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use include and exclude rules deliberately

--exclude removes matching paths from the transfer set, while --include allows selected paths when combined with broader filtering. Test the complete rule set with --dry-run. Pay special attention to whether an excluded destination file should remain; the default deletion behavior generally protects excluded files, but an explicit deletion-of-excluded-files setting changes that result.

Keep filter rules in the same documented command or configuration used by the scheduler. A manually tested command and a scheduled command with different filters are two different backup policies.

Do not confuse backup with a move

--remove-source-files removes successfully transferred non-directory files from the sender. That is a move workflow, not an ordinary backup. Use it only when the source is intentionally being drained after successful transfer and when you have an independent recovery plan for failures, accidental source selection or later corruption.

Directories are not removed by this option. If the requirement is simply to maintain a second copy, leave source files in place and omit --remove-source-files.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose a synchronization design

Design Direction Typical command policy Destination-only files Rollback copies Main risk
Incremental backup Push or pull -a, usually with -n before execution Remain Not created unless backup options are added A damaged or deleted source file is not automatically recoverable from this one destination tree
Mirror Push or pull -a --delete, always dry-run first Removed inside the synchronized scope Only if --backup and optionally --backup-dir are used Wrong paths, mounts or filters can cause unintended deletion
Backup with change retention Push or pull -a --backup --backup-dir=... Remain unless --delete is also selected Changed or deleted destination files are retained in the backup directory Retention storage can grow and is not immutable
Intentional move Push or pull -a --remove-source-files only when required Remain unless deletion is also selected Not supplied by this option Source files are removed after successful non-directory transfer

Schedule rsync without losing control

  1. Run a dry run manually and save its output to a log.
  2. Confirm the source and destination hostnames, accounts and absolute paths.
  3. Confirm that the SSH account has exactly the intended read or write permissions.
  4. Check destination free space, quotas and inode availability.
  5. Classify the job as a one-way backup, a mirror or a move before selecting --delete or --remove-source-files.
  6. Place the reviewed command in the platform’s service scheduler. Configure alerting for a non-zero exit status rather than treating a scheduled start as proof of success.
  7. Periodically perform an actual restore test to a separate location.

Keep the dry-run form available beside the production form. Before changing a path, filter, account or deletion policy, run that preview again. If a scheduler uses a different environment, specify the executable, SSH identity and any required options in the scheduler’s configuration rather than assuming an interactive shell will provide them.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Validate a backup with a restore test

An rsync process can finish without proving that the resulting data is usable. A restore test answers the question a backup is supposed to answer: can the required files be recovered?

Best Value
Sale
UnionSine 500GB Ultra Slim Portable External Hard Drive HDD-USB 3.0 | for PC, Mac, Laptop, PS4, Xbox one, Xbox 360-(Black)
  • [Upgraded Version] - This external hard drive features a mirrored logo stripe combined with a striped anti-slip design, and the rounded corners of the casing make it easier to grip. The stripes also have a heat dissipation function, ensuring stable and fast data transfer.
  • 【Ultra-thin and quiet】 - The motherboard adopts JMicron 578 noise-free solution, giving you a quiet working environment. Lightweight and portable size designed to fit in your pocket for easy portability.
  • 【Ultra-Fast Data Transfers】 - Pairing this external hard drive with JMicron 578 solution USB 3.0 and USB 2.0 interfaces enables blazing-fast data transfer. It boasts theoretical read speeds of up to 125MB/s and write speeds of up to 103MB/s.
  • 【Plug and Play】 - With no software to install, just plug it in and the drive is ready to use.The hard disk chip is wrapped with an aluminum anti-interference layer to increase heat dissipation and protect data.
  • 【What You Get】 - 1 x Portable Hard Drive, 1 x USB 3.0 Cable, 1 x User Manual, Gift-type shell packaging ,Three-year manufacturer's warranty and free technical support services.
  • Select a representative set of files, including large files, nested directories and files whose permissions matter.
  • Restore them to a separate directory or host so the live source and backup are not overwritten.
  • Check names, contents, timestamps and permissions against the source requirements.
  • Record how long the restore takes and whether the backup account can actually read the restored data.
  • Repeat after significant changes to paths, filters, accounts or scheduling.

If the job uses --backup-dir, include a retained replacement in the test. If it uses --delete, verify that the mirror contains exactly the intended scope and that excluded files follow the documented policy.

Troubleshoot the common failure modes

The command copies an extra directory level

Inspect the source trailing slash. Change /srv/data to /srv/data/ when the destination should receive the contents rather than a new data directory. Preview the corrected path before running it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

SSH works, but rsync reports permission errors

Test read access on every source directory and write access on every destination directory as the exact SSH account. Check ownership, mode bits, quotas and the destination mount. Archive mode can request ownership and group preservation that an unprivileged account cannot perform; adjust the account or the preservation requirements deliberately instead of suppressing errors.

Files you expected are missing

Review every --exclude and --include rule, then run a verbose dry run. Confirm that the source path is mounted and that the initiating host is connecting to the expected hostname. A successful connection to the wrong server can still produce a technically successful but useless backup.

A mirror wants to delete too much

Stop before removing -n. Recheck the source path, destination path, mount status, filters and account. If you do not need a mirror, remove --delete. If replacements must be recoverable, add the reviewed --backup-dir policy and ensure it has sufficient protected storage.

The second run still transfers files

Check whether files are changing during the transfer, whether metadata cannot be preserved because of permissions, and whether the two commands use identical paths and options. Compare a fresh dry-run list rather than assuming that a non-empty transfer list means rsync is malfunctioning.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A safe operating pattern

For most one-way server backups, begin with archive mode over SSH, use a trailing slash on the source contents, and preview with verbose dry-run output:

rsync -a -n -v -e ssh /srv/data/ [email protected]:/srv/backups/data/

After confirming the endpoints and file list, run the same command without -n. Add --delete only for a consciously managed mirror, add --backup --backup-dir=... when replaced destination files need rollback copies, and reserve --remove-source-files for an intentional move. Log scheduled runs, alert on failures, and prove recoverability with regular restore tests.

Quick Recap

Bestseller No. 1
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400) | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400) | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$129.99
Bestseller No. 2
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$208.99
Bestseller No. 3
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$119.80
Bestseller No. 4
Seagate Portable 4TB External Hard Drive HDD – USB 3.0, 1-Year Rescue | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
Seagate Portable 4TB External Hard Drive HDD – USB 3.0, 1-Year Rescue | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$208.99

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.