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.

  • limelight79@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    13 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.