Restoring Protection Group Volume Snapshots

FlashRecover protection groups can be defined at all the different object levels the FlashArray supports; volumes, hosts and host groups. Whenever a snapshot is created, the individual objects in the protection group are snapped together to create a point-in-time consistency group called a protection group snapshot. FlashRecover protection groups can be defined and managed from the Pure Storage GUI, CLI and Windows PowerShell. Protection groups are required for scheduling snapshots to occur locally or for snapshot to be replicated.

Microsoft SQL Server is a typical candidate for using a protection group as there may be many databases spread across multiple volumes, hosts or host groups. When defining the protection group and local snapshot policy a schedule can be created that includes how often to create a snapshot and length of retention.


Protection group snapshots allow you to recover volumes on the local array, for recovering from corruption or user error, or for creating clones for test & development. Protection group snapshots that are replicated to a target array can be used to recover from a disaster or can be cloned for creating dev/test instances on a secondary array.

One challenge when working with protection group snapshots is that each volume in the protection group must be recovered or cloned in order to recover the whole protection group. I’ve implemented a new cmdlet that allows you to easily recover all the volumes in a protection group snapshot in one single operation.

In this example I’ll use a protection group snapshot replicated from source array cs-perf-pure-02 with 6 members which are all volumes.


For discussion purposes lets suppose that the above schedule has been executing and has created 2 snapshots.


These 2 snapshots each contain a consistency group of the 6 members (volumes).


Restoring each of the members of the snapshot requires that each individual snapshot be copied to a new volume that can then be attached to a host or host group.


If we think about this situation and relate it to a disaster recovery scenario every second of downtime is crucial and this process would need further automation to support the business requirements. Thinking back to the example scenario of using Microsoft SQL Server we know that we are dealing with a Windows Server environment. With Windows we can take advantage of Pure Storage PowerShell Toolkit to automate this process and recover all of the volumes from this protection group snapshot in one operation.

function Restore-PfaProtectionGroupVolumeSnapshots()
	Param (
		[Parameter(Mandatory = $True)][ValidateNotNullOrEmpty()][string] $FlashArray,
		[Parameter(Mandatory = $True)][ValidateNotNullOrEmpty()][string] $ProtectionGroup,
		[Parameter(Mandatory = $True)][ValidateNotNullOrEmpty()][string] $SnapshotName,
		[Parameter(Mandatory = $True)][ValidateNotNullOrEmpty()][string] $Prefix,
		[Parameter(Mandatory = $False)][ValidateNotNullOrEmpty()][string] $Hostname,
		[Parameter(Mandatory = $True)][ValidateNotNullOrEmpty()][Microsoft.PowerShell.Commands.WebRequestSession]$Session


    $PGroupVolumes = Get-PfaProtectionGroup -FlashArray $FlashArray -Name $ProtectionGroup -Session $Session
    $PGroupSnapshotsSet = $SnapshotName

    ForEach ($PGroupVolume in $PGroupVolumes)
        For($i=0;$i -lt $PGroupVolume.volumes.Count;$i++)
            $NewPGSnapshotVol = ($PGroupVolume.volumes[$i]).Replace($PGroupVolume.source+":",$Prefix+"-")
            $Source = ($PGroupSnapshotsSet+"."+$PGroupVolumes.volumes[$i]).Replace($PGroupVolume.source+":","")
            New-PfaVolume -FlashArray $FlashArray -Name $NewPGSnapshotVol -Source $Source -Session $Session
            Connect-PfaVolume -FlashArray $FlashArray -Name $Hostname -Volume $NewPGSnapshotVol -Session $Session

Restore-PfaProtectionGroupVolumeSnapshots –FlashArray `
    –ProtectionGroup "CS-PERF-PURE-02:LT" `
    –SnapshotName "CS-PERF-PURE-02:LT.2" `
    –Prefix TEST `
    -Hostname TMEHOST1 `
    –Session $FASession

Note: An important point to note about the above PowerShell is that the calling cmdlet at the bottom of the example script assumes that there is an established Session created (eg. $FASession).

I implemented by creating the Restore-PfaProtectionGroupVolumeSnapshots function which uses other toolkit cmdlets (Get-PfaProtectionGroup and New-PfaVolume). After running the function with the parameters ProtectionGroup, VolumeSnapshots, Prefix and Session each of the individual volume snapshots have been restored.


This new function is now part of the updated release of the Pure Storage PowerShell Toolkit v2.2.1.302. The toolkit can be downloaded from GitHub or through the Pure Storage Community.


  • Nathan

    I take it that the members in the protection group needs to be volumes & not Hosts or host groups?

    • Hi Nathan –

      That is correct. Is a Host or Host Group an option you are looking to support? The one detail I wanted to avoid was automatically creating a large number of volumes that were connected to the Host or Host Group. I am working on an updated version of the Pure Storage PowerShell Toolkit 3 which leverages the PowerShell SDK for some operations.