Technical Note: XTN1702

Synchronize to a XenData Volume Using Robocopy

Updated Dec. 22, 2017

Overview
Robocopy is a free utility bundle with Microsoft Windows. It has been certified to work with XenData6 Server and XenData Cloud File Gateway software.

This technical note gives an overview of how to configure the XenData software and Robocopy to implement mirroring of a source storage file system. With appropriate configuration, Robocopy will provide a log of all file transactions.

Configure XenData as a Target for the Mirror
Create a new folder on the XenData volume to be the designated target for the mirror.

From the Management Console for the XenData software create a new Volume Set and a File Group rule that sends all files written to the new folder to the new Volume Set. Details of how to configure Volume Sets and File Group rules are found in the XenData Administrator and User Guides.

Mount your shared source storage file system on the XenData server, either via a network share or a locally mounted SAN.

Scripting using Robocopy
Robocopy is a basic command line utility that is very robust in its options. To create the script, open a new notepad document and save with the file extension BAT. This file should be stored on the C: drive of the XenData server.

The basic syntax for Robocopy is robocopy <Source> <Destination> [<File>[ …]] [<Options>]

Here is a sample script:

Robocopy \\192.168.#.###\Projects “X:\Mirrored Storage\Projects” *.* /mir /log+:C:\Log\Mirrored_Storage_%date:~-4,4%%date:~-10,2%%date:~-7,2%_%time:~0,2%%time:~3,2%%time:~6,2%.log

When specifying the source make sure to use the UNC path to the share.

The /mir switch Mirrors the Source to the Destination. This means when a file is deleted from the Source it is also deleted from the Destination. This is a one-way operation.

The /log+ switch allows you to export a log file for each run of the script appending as it goes per day.

By using the variable %DATE% you can create individual log files by day.

Here is a link to the Microsoft TechNet article for Robocopy, this includes all switch options: https://technet.microsoft.com/en-us/library/cc733145(v=ws.11).aspx

Do not use multithreading as this has been known to cause problems with LTFS formatted tapes.

Save your BAT file and close.

This can easily be made into a reoccurring job that is automatically launched by Windows Task Scheduler.

Defining a Schedule
Open Task Scheduler, from the start menu click the windows icon in the lower left corner and start typing "Task Scheduler". It should pop up as a highlighted option.

From the Task Scheduler actions pane select "Create Task…"

Name your task and set the task to Run whether the user is logged on or not. Change the user to one that has full access to both the source and destination paths.

On the Triggers Panel, add a new trigger. Set the required schedule.

On the Action panel, click "New…". Browse for the BAT file you previously created.

Click "OK" and set any other Conditions or Settings you may need.

Test your script by right clicking it in the Task Pane and select "Run". If there are any errors check your log files for details and troubleshoot.

Your script will now run autonomously creating log files that report which files were mirrored and when.

Applicable Operating Systems

  • Windows Server 2012 R2
  • Windows Server 2016
  • Windows Server 2019

Applicable XenData Software
This technical note is applicable to:

  • Version 6 – Server Editions of Archive Series software
  • Version 7 – Server Editions of Archive Series software including the Cloud File Gateway