Using Robocopy to copy files from an iSCSI share

When copying files from an iSCSI share to Windows, you can lose the file permissions. To prevent this, we recommend that you use the Microsoft tool, Robocopy, to perform this task.

This article provides a procedure to use Robocopy to copy files from an iSCSI share to a folder on Windows. These instructions also apply to iSCSI file restores. These instructions assume that you have already mounted the iSCSI volume on the target Windows machine. If not, follow the instructions in the article Mounting An iSCSI Share In Windows.

Procedure

For Windows, Robocopy is included with your OS. See the article Robocopy and a Few Examples (external link) for detailed usage information. To copy files from an iSCSI share on a Datto NAS to a Windows machine, the commands below can be run in an elevated command prompt.

Customize the following command to apply to your circumstances:

robocopy [source] [destination] /mir /Z /W:5 /fft /R:3 /secfix /copyall

Examples

IMPORTANT  Be extremely careful, as the /MIR flag will cause Robocopy to overwrite and delete data in the destination and its subdirectories. Use the colons (::) in front while typing the command, and remove them only when you are ready to execute the robocopy. For help with using Robocopy, see Microsoft's how-to article or contact Microsoft Support (external links).

This example copies the contents of the F: drive to the D: drive.

robocopy F: D: /mir /Z /W:5 /fft /R:3 /secfix /copyall

This example copies from one subdirectory to another subdirectory.

robocopy F:\Data D:\Data /mir /Z /W:5 /fft /R:3 /secfix /copyall

This example will copy a specific file or files from one directory to another. Note: WildCards can be used.

robocopy F:\Data D:\Data *.txt /Z /W:3 /fft /r:3 /v

The following list explains the meaning of each flag:

  • /MIR Mirrors a directory tree.

  • /Z Resumes transfer if interrupted during a large file copy.

  • /W:3 Waits three seconds before a retry.

  • /fft Assumes FAT file times, which has two-second precision, and is very close to real time.

  • /r:3 Allows for three re-tries before a file is dropped from the list.

  • /v Allows for verbose logging and output. This command is optional.