114

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) ?

slugster
  • 49,403
  • 14
  • 95
  • 145
user2279887
  • 1,191
  • 2
  • 8
  • 7

2 Answers2

126

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.

StackzOfZtuff
  • 2,534
  • 1
  • 28
  • 25
Luke Z
  • 2,369
  • 1
  • 17
  • 13
  • 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.»") – LogicDaemon Apr 27 '16 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 01 '16 at 19:11
  • 8
    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: https://serverfault.com/a/812212/268224 – user643011 Jun 12 '19 at 06:37
  • More info on `/Z` and `/B` here: https://superuser.com/a/468131/367018 – BurnsBA Oct 15 '20 at 20:17
  • 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. – franchyze923 Nov 20 '21 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 '22 at 16:08
1

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

Danarman
  • 11
  • 2