Repairing Virtual Disks

When a back-end physical disk fails in a disk pool it will can result in failed virtual disks. Failed mirrored virtual disks can be repaired by replacing the failed storage source with a new storage source from a healthy disk pool. The new storage source can come from a pool on any server in the server group.

A Windows PowerShell script file named Repair-DcsVirtualDisk.ps1 is included in the SANsymphony installation folder (default path C:\Program Files\DataCore\SANsymphony) to facilitate the repair of mirrored virtual disks. The script connects to a server and calls the DataCore Cmdlet Repair-DcsVirtualDisk with the parameters that are passed to the script in a task action.

In order to use the script without modification:

  • Create a task with a monitor trigger for the State of Virtual Disk Sources. Select the mirrored virtual disks to monitor and set the trigger state to be at least > Healthy. (See Automated Tasks for more information.)
  • Configure an action to run the PowerShell script file (C:\Program Files\DataCore\SANsymphony\Repair-DcsVirtualDisk.ps1) with the appropriate parameters, which are described in the cmdlet syntax and parameter examples below. Append the associated Task Trigger Data objects. When a trigger fires, the associated trigger state data objects will be appended to the script file action as a list of trigger states that caused the action to occur. In this case, the Virtual disk Id from the appended monitor trigger states could be compared using other cmdlets to obtain additional information about the virtual disks. See Trigger State Data for more information.
  • Set an action delay in the task settings so that the script will be executed after a desired amount of time in order to allow time for the virtual disks to go healthy.

When the virtual disk source state reaches Attention or greater, the trigger will fire and the action delay countdown will begin. After the delay time has been exceeded, the script file will run. The cmdlet will check for failed storage sources in the selected virtual disks and if found will replace the failed storage source with a storage source from a healthy disk pool. The new disk pool will be selected from a list of pool candidates provided as parameter values for the script file. When the storage source is replaced, all paths are adjusted to use the new source and mirrors are synchronized with a full recovery.

  • The script is intended to repair virtual disks in the event of connection or back-end storage failure—not server failure. If the server configured to run the script fails, the script will not execute. As a safeguard, a dedicated server could be configured to monitor and run tasks.
  • The repair operation will only repair failed mirrored virtual disks and will not be performed on healthy virtual disks or virtual disks in double failure. If the repair operation cannot be performed because virtual disks are healthy, a message will be posted in the Event Log. If the repair operation cannot be performed for any other reason, an alert will also be posted with an explanation.
  • During the repair operation, mirrored virtual disks are split and the healthy side is remirrored. This results in the creation of auto-generated single virtual disks from the failed pool at the point of replacement. These auto-generated virtual disks can be deleted in order to reclaim space used in the pool.
  • If the original pool disks come back online after a repair has been triggered, auto-generated single virtual disks will be created and displayed in the management console for those storage sources that were repaired. The auto-generated virtual disks can be deleted (after verifying that the mirrors are up-to-date and healthy after the repair) in order to reclaim the space used in the disk pool.
  • Ensure adequate space is available in pools to accommodate repairing the virtual disks. A dedicated pool could be used for this purpose.
  • Snapshots and rollbacks created from the failed storage source will be deleted.
  • Repairing the storage source of a virtual disk in a replication is not allowed.
  • Repairing the storage source of a CDP-enabled virtual disk will disable the CDP feature if the side which has the history log is repaired. After the virtual disk has recovered and data is up-to-date, CDP can be enabled again. Repairing the storage source which does not have the history log will not affect CDP for the virtual disk.

Repair-DcsVirtualDisk Cmdlet Syntax

The Repair-DcsVirtualDisk cmdlet is included in the suite ofs and can also be run directly from the DataCore Cmdlet window. See Getting Started with DataCore Cmdlets for complete information.

The cmdlet has three parameter sets:

Repair-DcsVirtualDisk -TriggerState <Object> -DiskPools <String[]> [-LocalServerOnly] [-Connection <String>]

Repair-DcsVirtualDisk -VirtualDisk <Object> -DiskPools <String[]> [-LocalServerOnly] [-Connection <String>]

Repair-DcsVirtualDisk -LogicalDisk <Object> -DiskPools <String[]> [-LocalServerOnly] [-Connection <String>]

Parameter Descriptions:

Parameter Description

VirtualDisk

The VirtualDiskData object, Id, or name which identifies a virtual disk. This parameter is intended for cmdlet support. When this script parameter is omitted, all valid monitored objects in the task will be repaired. To use the VirtualDiskData object or multiple virtual disks, the script will require some modification (see Get-DcsVirtualDisk for more information).

LogicalDisk

The LogicalDiskData object, Id, or name that identifies a storage source (logical disk). This parameter is intended for cmdlet support. When this script parameter is omitted, all valid monitored objects in the task will be repaired. To use the LogicalDiskData object or multiple logical disk objects, the script will require some modification (see Get-DcsLogicalDisk for more information).

TriggerState

The TriggerState object that identifies the trigger state data of the failed storage source. The trigger state data is linked to monitor triggers as well as replication checkpoint triggers in a task. The trigger states will be appended to the script when the Append trigger state data check box is selected for the PowerShell script action in the task. For instance, if the task was triggered by a monitor changing state, the trigger state data object returned will have a field called MonitoredObjectId which will be used to find the corresponding failed storage source and repair it. This parameter is only valid when running a script action in a task.

DiskPools

A comma separated list of pool candidates to use as the new storage source. The pool will be automatically selected from the list. Eligible candidates will be online and healthy, and cannot exist on the same server as the healthy storage source side of the mirror. The list can include pools from different servers, but a pool on the same server as the failed storage source will be preferred in order to keep the same front-end paths and avoid a rescan on the host. The first eligible pool in the list of pool candidates will be used. All pool names must be unique in the server group. For example, if the DiskPools parameter is "Disk pool 1", "Disk pool 2", "Disk pool 3". If all three pools are eligible candidates and "Disk pool 1" resides on the same server as the failed storage source, "Disk pool 1" will be selected.

To include shared disk pools in the list, use the extended caption for the pool in order to identify which server to use to create the storage source and corresponding paths. For instance "SharedPool1 on Server1".

LocalServerOnly

A switch parameter that indicates to only use disk pools from the same server that has the failed storage source. This will prevent the host paths from being replaced which would force the host to perform a disk rescan to see the new paths. This cmdlet will always prefer to repair a virtual disk using local resources, but without this parameter, the cmdlet will split and remirror a virtual disk to repair it if local resources are not available.

Script Parameter Examples

To repair all virtual disks that are being monitored:

-DiskPools "Disk pool 1", "Disk pool 2", "Disk pool 3", "Disk pool 4" -LocalServerOnly

Note: The LocalServerOnly parameter is included to require that a disk pool from the same server as the failed storage source will be used.

To repair a specific virtual disk:

-VirtualDisk "Virtual disk 8" -DiskPools "Disk pool 1", "Disk pool 2", "Disk pool 3", "Disk pool 4"