116

robocopy /Z = "copy files in restartable mode".

What does this option do? All the documentation I've found simply quotes the on-board manual. What is "restartable" mode, why would someone use it, and how does it differ from "Backup mode" (/B) ?

0

2 Answers 2

128

Restartable mode (/Z) has to do with a partially-copied file. With this option, should the copy be interrupted while any particular file is partially copied, the next execution of robocopy can pick up where it left off rather than re-copying the entire file.

That option could be useful when copying very large files over a potentially unstable connection.

Backup mode (/B) has to do with how robocopy reads files from the source system. It allows the copying of files on which you might otherwise get an access denied error on either the file itself or while trying to copy the file's attributes/permissions. You do need to be running in an Administrator context or otherwise have backup rights to use this flag.

6
  • 5
    hi. I know it's old question, still I'm not very convinced. Can you elaborate please? If a file is copied partially, and then changed in source, will robocopy /z make corrupted file, like xcopy? Why /z and /b are mutually exclusive? [*](# "(per manual: «/ZB :: use restartable mode; if access denied use Backup mode.»") Apr 27, 2016 at 15:39
  • 3
    @LogicDaemon My best guess is, that backup mode does not allow restarts; therefore, using restartable mode is preferable if there actually isn't a permission error.
    – jpaugh
    Dec 1, 2016 at 19:11
  • 9
    Be aware that /z can have massive performance penalty. In my case I was seeing an improvement of 20MB/s to 600MB/s after removing /z. Source: serverfault.com/a/812212/268224
    – user643011
    Jun 12, 2019 at 6:37
  • 1
    agree with @user643011 I had copied a command I found for a typical backup and it included the /Z flag. It was very slow so I started looking into it and after removing /Z copied much faster. Nov 20, 2021 at 19:01
  • 2
    @user643011 The reason for the performance drop is due to the extensive extra logging that is required to "recover" a failed file
    – Cornbeetle
    Apr 29, 2022 at 16:08
0

Please be aware:

When using restartable mode /Z or /ZB (/ZB try to use restartable mode, if can't, use backup mode), this mode assumes that source file is ready to copy. If file is being generated (ie: compressed file automation and launch copy before completes -time of day-, will result to a corrupted target file). I faced this when automated the compression of backup files on other computer (remote) and the compression should finish at 9:00pm, so I programmed copy that file at 9:30pm... apparently everything was copied ok, no errors, but copied file results corrupted because due to other tasks used on that remote computer at the time, the compression took 45 minutes more. This way the compressed file was still in progress when robocopy /zb started (was using restartable mode due to no issues to use it), the compressed file still in progress for 15 more minutes.

Removed the /ZB and, since this, I use /B only. In backup mode ( /B ) Robocopy try to read the file exclusively. If source file is not ready yet, Robocopy fails and retry, after 30 seconds, as many times as you specified with /R parameter. I use /R:100

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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