Data ONTAP PowerShell Toolkit - Find LUN and Vol Clones holding Snapshot

by lobanov Netapp Alumni on ‎2011-04-07 05:15 PM

If you are using FlexClone functionality of NetApp array to create and destroy LUN and Volume clones in automated way, you probably had such situations where snapshots need to be destroyed, but array doesn't let you to delete snapshot because is busy with clone. Finding such Volume or LUN clones sometimes is challenging task requires executing multiple commands.

My customer has automated system which creates hundreds and thousands of clones every day and sometimes fails to clean up. As a result it leaves Storage Administrator with task of cleanings snapshots and clones after such failures. To make this task a bit easier I put together GetSnapshotClones.ps1 script to extract Volume and LUN clones dependent on Snapshot of the Volume. Script takes two parameters - Volume and Snapshot and returns array of clone objects.

Here is an example of calling script and script output.

PS C:\@work\Scripts> .\GetSnapshotClones.ps1

Name           : Win2K8R2_VOL_FUJI_16
ParentVolume   : Win2K8R2_VOL_MASTER
ParentLun      :
CloneType      : Vol
ParentSnapshot : clone_Win2K8R2_VOL_FUJ.1

Name           : Win2K8R2_VOL_FUJI_15
ParentVolume   : Win2K8R2_VOL_MASTER
ParentLun      :
CloneType      : Vol
ParentSnapshot : clone_FUJI_15_BOOT_VOL.1

Name           : Win2K8R2_VOL_FUJI_14

ParentVolume   : Win2K8R2_VOL_MASTER
ParentLun      :
CloneType      : Vol
ParentSnapshot : clone_FUJI_14_BOOT_VOL.1


This NetApp Community is public and open website that is indexed by search engines such as Google. Participation in the NetApp Community is voluntary. All content posted on the NetApp Community is publicly viewable and available. This includes the rich text editor which is not encrypted for https.

In accordance to our Code of Conduct and Community Terms of Use DO NOT post or attach the following:

  • Software files (compressed or uncompressed)
  • Files that require an End User License Agreement (EULA)
  • Confidential information
  • Personal data you do not want publicly available
  • Another’s personally identifiable information
  • Copyrighted materials without the permission of the copyright owner

Files and content that do not abide by the Community Terms of Use or Code of Conduct will be removed. Continued non-compliance may result in NetApp Community account restrictions or termination.