Who's Yer Daddy!?!?!...or...How to Find a Clone's Family Tree

Blog Post created by nschoonover Employee on Oct 30, 2013

I ran into a scenario today where I needed to delete a volume that was busted, which normally sounds simple. However, being a lab system, nothing is EVER simple. The issue that I ran into was that I couldn't delete the volume because clones had been created from its' snapshots. What's worse is that I didn't have any way of determining the names of the cloned volumes without going through the entire array volume list and checking each volume's parent. Here's a PowerShell script that I threw together that leverages Plink (part of Putty) to connect to the array and parse volumes and their parents, if any, producing a lineage. Note: the sanjose.bat file that I use contains the Plink command as follows, I just like having it contained in the array name so I can instantly reference the array by name and then just type a string with the Nimble command I want to run such as: sanjose "vol --list". Copy and modify at will. Also, I'm not really a PowerShell guy (exhibited by my use of semicolons to end lines <g>) so improvements are greatly welcome as I went for function to get the job done.

--- SanJose.bat ---

@echo off

plink -ssh admin@<your array IP/Name> -pw <password> %1


--- cloneLineage.ps1 ---

Function Get-Volume-Parent($sVolName) {


  # Get the Volume Info


  $cmdVolInfo = 'C:\Users\Nicholas\sanjose.bat "vol --info ' + $sVolName + '"';

  $resVolInfo = iex $cmdVolInfo;


  # Parse the Volume Parent, if any


  $xVolParent = [regex] "Parent volume: (.*)";

  for ($iInfoLine=0; $iInfoLine -lt $resVolInfo.length; $iInfoLine++) {

  if (($resVolInfo[$iInfoLine] -match $xVolParent) -and ($matches[1] -ne "N/A")) {

  $sVolParent = $matches[1];

  Write-Host -NoNewline " -> " $sVolParent;


  # Recursive Call







# Get list of volumes


$cmdVolList = 'C:\Users\Nicholas\sanjose.bat "vol --list"';

$resVolList = iex $cmdVolList;

$xVolName = [regex] "\S+";

for ($iLine=4; $iLine -lt $resVolList.length; $iLine++) {

  $sVolName = $xVolName.match($resVolList[$iLine]).value

  Write-Host -NoNewline $sVolName;