I need to clone an external drive to another identically sized drive. Rsync seems like the best simplest option for this, and I'll just hook it up to a cron job to run periodically.

But what options should I be using for it? I just need to clone all files and folders to the new drive, replacing older copies, and deleting files that aren't on the original drive.

The drives are mounted via fstab like so

LABEL=Osirion    /media/Osirion    exfat   defaults,umask=000,nobootwait           0       2
LABEL=Hyperion   /media/Hyperion   exfat   defaults,umask=000,nobootwait           0       2
  • I'm fine with that, as the other drive is just a backup in case of failure. Currently I was thinking rsync -va --delete --progress /source /dest. Does that seem right? – cclloyd Jun 27 '18 at 3:08
  • I think you got your answer. (my previous comment is errorneous. I did suggest something that mirrors, but the -MIR flag is for robocopy instead of rsync - sorry about that). Just checking the manual for rsync they have some sample usage rsync -avz /source /dest and then you have --delete and --progress which delete extraneous files, and progress bar. the z is to compress files while in transit - hopefully reducing the time required to copy files in between, but that may be personal preference. You should put your comment as an answer as it is a good one =) – Darius Jun 27 '18 at 3:17

You can use rsync like so:

rsync -ravHl --delete /media/Osirion /media/Hyperion/

Note the trailing slash at the end of Hyperion destination.

-r means recursive, -a archive, -v verbose, -H preserve hard links, -X preserve extended attributes and --delete makes rsync to remove deleted files in the source directory.

Check the man page for more information on additional parameters: man rsync

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.