About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.
An off-site copy that is kept in step with the source is a mirror, and a mirror repeats every deletion. If someone removes backup files at the source, whether by clean-up or by mistake, the next run removes them from the copy. The same happens when the source holds damaged or renamed files. Four common tools do this: rsync with --delete, rclone sync, two-way sync, and S3 replication with delete marker replication switched on.
Find which one your job uses by reading its command line or rule, not by guessing. Then change it to a copy that adds and keeps, and put the clean-up of the copy somewhere separate, with its own credentials.
What the symptom means
The tools differ in what counts as a delete, and that decides what survives.
rsync. The manual says --delete "tells rsync to delete extraneous files from the receiving side (ones that aren't on the sending side), but only for the directories that are being synchronized." It adds: "This option can be dangerous if used incorrectly! It is a very good idea to first try a run using the --dry-run (-n) option to see what files are going to be deleted." Since rsync 3.0.0 the default delete mode is --delete-during; --delete-before, --delete-after and --delete-delay change the timing, not the outcome. --delete-excluded also deletes files at the destination that your exclude patterns skip.
rclone. rclone sync makes the destination match the source: "Destination is updated to match source, including deleting files if necessary". The same page says: "If you don't want to delete files from destination, use the copy command instead." and "Important: Since this can cause data loss, test first with the --dry-run or the --interactive / i flag." rclone copy "Doesn't delete files from the destination."
Two-way sync. rclone documents bisync as "considered an advanced command". Its sample log shows deletes queued and run on both paths, and its --max-delete option is a "Safety check on maximum percentage of deleted files allowed. If exceeded, the bisync run will abort. (default: 50%)". It is a way of keeping two working folders alike, which is the opposite of what a backup copy needs.
S3 replication. AWS is explicit that behaviour depends on the kind of delete. A simple delete without a version ID adds a delete marker at the source. With the latest replication configuration, which has a Filter element, "Amazon S3 does not replicate the delete marker by default". If the rule has no Filter (the older V1 form), it "replicates delete markers that resulted from user actions". If delete marker replication is enabled, "Amazon S3 behaves as if the object was deleted in both the source and destination buckets." Deleting a specific version at the source is not copied: it "doesn't replicate the deletion in the destination buckets... This protects data from malicious deletions." Markers created by lifecycle expiry are not replicated either.
Likely causes
| Cause | What you see | How to confirm |
|---|---|---|
rsync run with --delete (or a variant) |
Files missing from the copy that were deleted at the source | The job's command line; a dry run reports deletions as *deleting |
rclone sync instead of copy |
The same, for cloud or SFTP targets | The command name in the job; a --dry-run shows what would go |
| Two-way sync or bisync used as backup | Deleting in either folder deletes in both | Tool name and configuration |
S3 replication with delete marker replication enabled, or an older rule with no Filter |
Objects look deleted in both buckets | get-bucket-replication shows DeleteMarkerReplication and whether a Filter exists |
| Source changed, copy followed | Encrypted or renamed files appear in the copy and replace good ones | Compare file names and modified times in the copy against an earlier listing |
| Sender holds delete rights on the destination | Any tool can remove copies | Check the permissions of the account the job uses |
Prove the cause before changing anything
These commands read or simulate only. They are taken from vendor documentation and have not been run.
-
Read the job. Look in the scheduled task, script or tool configuration and note the exact tool, flags and paths. The flags named above are what you are looking for.
-
For rsync, repeat the same command with
--dry-runand--itemize-changesadded. The manual describes a dry run as "a trial run that doesn't make any changes", and says deletions are logged with the string*deleting. For example:
rsync --archive --delete --dry-run --itemize-changes /srv/backup/ /srv/offsite/
Use your own source and destination, exactly as the real job has them. Good result: no *deleting lines for files you meant to keep. Bad result: a list of files that exist only on the copy.
-
For rclone, add
--dry-run(short form-n) to the realrclone syncline and read the log with-v. -
For S3 replication, read the rule:
aws s3api get-bucket-replication --bucket fs01-source-bucket
In the reference, DeleteMarkerReplication "specifies whether Amazon S3 replicates delete markers"; a Status of Enabled means markers are copied. If the rule has no Filter, AWS says the V1 behaviour copies user-caused markers.
Example (illustrative): fs01 pushes /srv/backup/ to /srv/offsite/ every night at 02:00 with rsync --archive --delete. At 14:00 an administrator removes 1,200 old backup files to free space, averaging 350 MB each: 1,200 x 350 MB = 420,000 MB, or 420 GB. At 02:00 rsync deletes the same 1,200 files from the copy. Three days later someone needs one of them, and neither side has it. Had the job carried --max-delete=100, rsync would have deleted 100 files, skipped the other 1,100, printed a warning and exited with code 25, which a monitor could have caught. That is a tripwire: 100 files were still lost.
Fix
rsync
Remove --delete so the copy only adds and updates. Then the copy grows, so you need your own clean-up on the destination.
If you want deletions at the source to take effect on the copy but stay recoverable, add --backup with --backup-dir. The manual says preexisting destination files "are renamed as each file is transferred or deleted", and --backup-dir "tells rsync to store all backups in the specified directory on the receiving side". It also warns: "if you specify a relative path, the backup directory will be relative to the destination directory, so you probably want to specify either an absolute path or a path that starts with "../"." Use a dated absolute path outside the mirrored tree:
rsync --archive --delete --backup --backup-dir=/srv/offsite-deleted/2026-11-17 /srv/backup/ /srv/offsite/
This changes a deletion into a move. The moved files now need their own retention. The linked article on rsync snapshot rotation covers a different design, --link-dest, in more detail.
Consider --max-delete=NUM as an alarm. It is a cap, not a guard.
rclone
Use rclone copy for the backup copy. If the destination must follow deletions, rclone's --backup-dir "moved in their original hierarchy into this directory" any file that would be overwritten or deleted, and --suffix adds a suffix to moved files. Do not rely on --immutable: the documentation says "files will be created and deleted as requested, but existing files will never be updated". --max-delete "tells rclone not to delete more than N files. If that limit is exceeded then a fatal error will be generated and rclone will stop the operation in progress"; it is a cap, not protection.
Two-way sync
Stop using it as a backup copy. Use a one-way, add-only copy.
S3 replication
In the replication rule, set DeleteMarkerReplication to Disabled, and give the rule a Filter so you are not on the V1 form. Then a plain delete at the source adds a marker only at the source. Three consequences follow:
- Replication requires versioning on both buckets ("Both source and destination buckets must have versioning enabled").
- The destination's lifecycle configuration is separate. AWS says changes to a bucket's lifecycle configuration "are not applied to the destination bucket". Nothing will ever expire the destination's versions unless you add a rule there, so it will keep growing. The topic of a versioned S3 bucket that keeps growing covers that rule.
- If anyone's credentials can still delete versions in the destination bucket, the copy is not protected from that person. Separate the credential that writes the copy from the one that cleans it up.
Disruptive step: editing the replication rule or the job takes effect at the next run. Make the change when no copy is running, and keep the old definition so you can restore it. Switching off --delete cannot bring back files already removed from the copy.
The copy has already lost files
Stop the job first, then check the destination for versions or snapshots, and look for any third copy. If the destination was unversioned and no snapshot exists, the deleted files are gone from that copy. A copy that follows the source is a second place for the same mistake, not a separate protection.
Confirm the fix
- Delete a harmless test file at the source, run the job, and confirm it is still present at the copy (or in the moved-aside folder).
- Run the dry-run command again and confirm there are no
*deletinglines. - For S3, read
get-bucket-replicationagain and check thatDeleteMarkerReplicationshowsDisabled. - Check a restore from the copy, not just a file listing.
What to watch afterwards
- Alert on exit code 25 from rsync and on any rclone fatal error.
- Monitor the destination size. An add-only copy only grows, so schedule its own clean-up.
- Keep the credential that can delete from the copy off the machine that writes it.
- Run a test of a recovery from the copy twice a year at least.
Read next
Related articles you may want next.
- Backup & Recoveryrsync snapshot backups with --link-dest: rotation, deletion and their limitsHow rsync --link-dest and rsnapshot hard-link snapshots work, what rotation and permission changes do, why they are not immutable, plus read-only checks.Read article
- Backup & RecoveryLogical air gap and physical air gap for backup repositoriesWhat offline and logically isolated backup copies each stop, where they fail, and how CISA and NIST describe a copy an attacker cannot reach.Read article
- Backup & RecoveryS3 backup bucket keeps growing after backups are deleted: noncurrent versions and delete markersDeleted backups from a versioned S3 bucket but the size did not fall? Find noncurrent versions and delete markers, then expire them with a lifecycle rule.Read article
Risks and limits
- These commands have not been run or lab-tested. They are taken from the rsync and AWS documentation, and the rclone pages.
- Moving deleted files into a separate folder uses space and needs its own retention.
- The rclone pages show neither a version nor a date, so check the flags against
rclone --helpon your system. - A copy is not independent of the source if the same account can delete from both. See the linked article on logical and physical air gaps.
- Outputs shown for rsync are the manual's description, not a recorded run.
Sources
- rsync(1) manual page, rsync 3.4.4 (8 Jun 2026) — man7.org rendering, created 2026-09-09, accessed 17 November 2026
- rclone sync — rclone documentation, no version or date displayed, accessed 17 November 2026
- rclone copy — rclone documentation, no version or date displayed, accessed 17 November 2026
- rclone bisync — rclone documentation, no version or date displayed, accessed 17 November 2026
- rclone global flags and options — rclone documentation, no version or date displayed, accessed 17 November 2026
- What does Amazon S3 replicate? — Amazon S3 User Guide, no date displayed, accessed 17 November 2026
- Replicating delete markers between buckets — Amazon S3 User Guide, no date displayed, accessed 17 November 2026
- Requirements for replication — Amazon S3 User Guide, no date displayed, accessed 17 November 2026
- get-bucket-replication — AWS CLI command reference, no date displayed, accessed 17 November 2026
This article was originally published on .