27
submitted 2 days ago by Harisfromcyber@lemmy.ml to c/linux@lemmy.ml

I wanted a sanity check on my current rsync flags. Posts on Reddit seem to highlight the use of rsync -avz for most use cases, for some instances even for when someone asks for mirroring a drive: https://www.reddit.com/r/DataHoarder/comments/rau071/rsync_command_to_mirror_drive/. This has not worked for me for the following case:

Drive #1:

file1.txt
file2.txt

Drive #2:

file1.txt
file2.txt
file3.txt

With -avz, file3 on the destination would not be deleted. With experimenting, I ended up now using rsync -havziP --delete-after --info=progress2 dir1/ dir2/, which actually ended up mirroring the drives for me. My question is: is this the best rsync approach for mirroring drives or was there a better option that works better?

Side note: it is interesting that rclone sync from rclone (https://rclone.org/commands/rclone_sync/) claims to delete by default, while with rsync it seems to be something you have to distinctly mention.

top 14 comments
sorted by: hot top controversial new old
[-] limelight79@lemmy.world 2 points 23 hours ago

You have your answers, but I just want to note that what I do is run rsync from cron nightly, without the delete option.

Basically this reduces the chances of losing something by accidentally deleting it on the primary drive. Every few weeks/months, I run the rsync command with the delete option to clean up.

It's not a perfect backup by any means, especially since I could erroneously delete something right before that second rsync command and lose it for good. But it does provide a measure of safety.

[-] Harisfromcyber@lemmy.ml 1 points 11 minutes ago

Thanks for sharing. I do something similar with the --delete option on an external drive in case I screw something up.

[-] IsoKiero@sopuli.xyz 10 points 2 days ago

There's also --delete-before which might help if your destination is tight on available space. And, as usual with 'traditional' tools, man-page is pretty good, there's a ton of parameters which might be helpful. And, as @hades@feddit.uk already mentioned, compression (-z) may actually hurt performance if you have a lot of bandwidth or if you're copying over already compressed data like JPGs.

[-] Harisfromcyber@lemmy.ml 2 points 1 day ago

I wasn't aware of the full impact of -z. Thanks for clarifying that for me (thanks to @hades@feddit.uk as well!). I'll definitely keep an eye on the speed with -z vs without it when I do my next dry run.

[-] IsoKiero@sopuli.xyz 2 points 1 day ago

If I'm not mistaken, dry-run (-n) doesn't give you the results as it doesn't actually transfer nor compress data. It's only useful to verify that the command you'll testing will actually do what you want. For performance measurement you can use --progress and --stats.

[-] Harisfromcyber@lemmy.ml 1 points 1 day ago

Thanks! good to know. I'll keep that in mind.

[-] hades@feddit.uk 7 points 2 days ago

-z might be pointless since you’re transferring files locally.

[-] Magister@lemmy.world 8 points 2 days ago

I do about the same, something like rsync -av --delete

[-] Harisfromcyber@lemmy.ml 5 points 2 days ago

Thanks for sharing! glad to see the --delete item being the key.

[-] MagnificentSteiner@lemmy.zip 3 points 2 days ago

Same here. My local backups are rsync -av --delete

[-] Infernal_pizza@lemmy.dbzer0.com 3 points 2 days ago

I usually use rsync -azP --delete but I'm not sure if that's the best option.

[-] BCsven@lemmy.ca 0 points 2 days ago

Grsync makes this easier :)

[-] Martin2789@lemmy.world 2 points 2 days ago

never used it what is different/better to rsync?

[-] BCsven@lemmy.ca 2 points 2 days ago* (last edited 2 days ago)

Graphic interface, you just click options. And it has drop downs for favourite folders you've configured before so you can switch between backup/sync locations.

Once you apply, it runs rsync, and it it shows you the CLI command used as visual reference

this post was submitted on 22 May 2026
27 points (96.6% liked)

Linux

65433 readers
451 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 7 years ago
MODERATORS