Correlate a Volume to Source Snapshot

I received a request from a customer to determine what snapshot is the source of a created volume. Before I dig into how to determine the correlation using the Pure Storage PowerShell SDK there is a detail about our FlashRecover Snapshots that you need to understand. Our snapshots are all immutable objects, meaning that there is no dependency for a volume or snapshot chaining.

For example, if VolumeA has 100 snapshots you can delete snapshot 8, 22 and 57 and there is no affect to any of the other snapshots in the chain. Additionally, if one of the snapshots was used to create a new volume the parent volume of the snapshot can be deleted with no affect. This is a pretty powerful capability as there are other storage vendors that cannot do what we can.

With the above understanding the reason the customer was asking about “what volume is the source of a snapshot” is because the capability above was not completely understood. But I still wanted to put together a PowerShell script to show how what volume is the source of a specific snapshot. This is a good example of what can be accomplished with our SDK.

Before getting into the scripting I want to visually illustrate how we are figuring out the ownership of snapshots to volumes. In the below screenshot the parent volume, Barkz-Ex13-Db-01, has a snapshot created named Barkz-Ex13-Db-01.MANUAL-01 with a Created data 2016-06-23 14:19:38. The snapshot was used to create a new volume named Mailbox-SMBR-MANUAL-01.

 

 

Looking at the new volume details for the newly created from the snapshot shows that the new volume created date is the same as the snapshot created date. This allows us to correlate volumes and snapshot sources using the Pure Storage PowerShell SDK.

 

The PowerShell script to accomplish the correlation is as follows:

$EndPoint = Read-Host -Prompt ‘Enter the Pure Storage FlashArray IP/DNS: ‘
$FlashArray = New-PfaArray -EndPoint $EndPoint -Credentials (Get-Credential) -IgnoreCertificateError
$vols = Get-PfaVolumes -Array $FlashArray
ForEach ($vol in $vols) {
  Try {
     $snaps = Get-PfaVolumeSnapshots -Array $FlashArray -VolumeName $vol.source
     ForEach($snap in $snaps) {
        If($vol.created -eq $snap.created) {
           If($snap.source -contains $vol.source){
             “Volume Name: $($vol.name)
             “Source Snapshot: $($snap.name)
           }
        }
     }
  }
  Catch {

    Write-Warning “No associated snapshot for $($vol.name).”
  }
}

 

The output below illustrates via script what was illustrated in the Web Management interface. You can see the Mailbox-SMBR-Manual-01 has a source snapshot of Barkz-Ex13-Db-01.MANUAL-01.

 

I will be adding this to the Pure Storage PowerShell Toolkit as a new cmdlet called Get-PtkVolumeSourceSnapshot.

Cheers,
Barkz

Add Comment

Required fields are marked *. Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.