Wednesday, 23 October 2019

The Curly Bracket Technique: Deleting Snapshots Older than Time X

The curly brackets in NetApp ONTAP Clustershell CLI are very useful, but their use maybe not widely broadcast. The curly bracket technique appeared in my Brief Notes section in July 2015, but I thought I’d give the knowledge a bump.

Say you want to:
- delete all snapshots
- for every volume with the naming convention *LOGS*
- in the vserver (or SVM) called SVM1
- that are older than 30 days

All you need to do from the Clustershell is::>


set -confirmations off
snapshot delete {-vserver SVM1 -volume *LOGS* -create-time <30d}
set -confirmations on


That’s it!

Setting confirmations to off, just means you don’t have to answer y to “do you really want to delete this snapshot” for every snapshot.

Image: Deleting all snapshots older than 2 hours using the curly bracket method

No comments:

Post a Comment