How to Count Snapshots in Clustered Data ONTAP in 8.2

Back in November I posted a PowerShell script for counting the number of snapshots your volumes have:

The great news is that in Clustered Data ONTAP 8.2 you don’t need to use it! In Clustered Data ONTAP 8.2 there is now a field called “Number of Snapshot Copies in the Volume.”

::> vol show vol1 -fields snapshot-count
vserver volume snapshot-count
------- ------ --------------
vs1     vol1   10

If you want to find all the volumes in your cluster which have say over 200 snapshots, it’s a one line CLI command:

::> volume show -snapshot-count > 200 -fields snapshot-count

Note: Data ONTAP and Clustered Data ONTAP can have a maximum of 255 snapshots per volume.

I must have missed the update that mentioned this excellent new addition to the information you can get for volumes via the CDOT 8.2 CLI (I’d been wondering why it was missing amongst all the fields that were available.) The circumstance of my discovery was investigating why OnCommand Unified Manager 6 (OCUM 6) couldn’t count snapshots on a CDOT 8.1.3 cluster, and hovering over the information icon revealed the tooltip that it could only do it in CDOT 8.2 or later, the why being that the field OCUM 6 uses to get the information does not exist in CDOT 8.1.3 (OCUM 5.1/2 can count CDOT 8.1.3 snapshots.)

Image: OCUM 6 > Configuration of snaphot count threshold