is using robocopy with the /MIR switch safe?

Hello,

I am using Robocopy to copy my c:\users\username directory to a second hard drive (D:). No problem. But I also want to mirror that second hard drive to a third hard drive (E:). I have been using the /MIR switch to copy/mirror hard drive D: to E:.
We know that /MIR deletes various files folders from the destination drive (E: in this case) if they no longer exist on the source drive (D:).

But, I recently  saw somewhere on the internet, that there is some risk that /MIR can also delete some of the source files, under certain circumstances. Scary!
Here's the exact quote (unfortunately I did not record the site it came from.)

Use the /MIR option with caution - it has the ability to delete a file from both the source and destination under certain conditions.

This typically occurs if a file/folder in the destination has been deleted, causing ROBOCOPY to mirror the source to the destination. The result is that the same files in the source folder are also deleted. To avoid this situation, never delete any files/folders from the destination - delete them from the source, and then run the backup to mirror the destination to the source.

If in doubt, do not use the /MIR option, but be aware that backups will take longer.


So I am asking if this is true and/or relevant to my needs.  The explanation above doesn't make a lot of sense to me. For the time being, I have abandoned the /MIR switch and am just using the Robocopy command to copy the second HD to the third.

Many thanks for thoughts or advice or links.

Jack
Answer
Answer

The /MIR switch is NOT a two way synchronization.  Right from the Microsoft documentation, it tells you /MIR is /e + /purge.  It does not delete files from the source.  The /MOV option DOES delete files from the source because you are moving them from the source to the destination.

 

The /mir option is equivalent to the /e plus /purge options with one small difference in behavior:

  • With the /e plus /purge options, if the destination directory exists, the destination directory security settings are not overwritten.

  • With the /mir option, if the destination directory exists, the destination directory security settings are overwritten.

44 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Answer
Answer

I agree with abbott1965, "The /MIR switch is NOT a two way synchronization."

If you really think about it, the ability for robocopy to delete files from the source doesn't make sense.  Consider this example for which disk has which files:

Day 1

Source:  A.txt B.txt C.txt

Destination: None

robocopy source to destination

Source: A B C

Destination: A B C

Day 2

Source: A B C D (d is a new file from day 1)

Destination: A B C

If we didn't have the knowledge from the past, we wouldn't know if the D file was added to the Source or if the D file was deleted from the Destination. It doesn't matter because:

robocopy source to destination

Source: A B C D

Destination: A B C D

Day 3

Source A B C D

Destination: A B C (D is deleted)

See, this is the same situation as Day 2.

robocopy source to destination

Source A B C D

Destination A B C D

I think the original person that wrote the comment about Source files being deleted was inexperienced. They accidentally did a robocopy command Destination to Source and didn't realize what they had done.

Just my two cents,

James

30 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated March 30, 2024 Views 81,703 Applies to: