Powerful Google developer tools for immediate impact! (2023-24 C)
How to sort netapp snapshots based on age using command line on cdot
1. How to determine snapshots based on
the age without using any script, just
command line on NetApp cDOT/ONTAP
Note: Following two mathematical symbols would enable us to sort the snapshots based on their
age. However, the way they operate in ONTAP is confusing atleast for me. Hence, I have interpreted
them slightly differently in order to remove any confusion.
Symbols and what it does from ONTAP context:
'<' = Include everything i.e. ‘NOT less than x days’
'>' = Include everything i.e. ‘less than x days’
For example:
1) To find out snapshots older than 30days, use the symbol '<'
cdot:: volume snapshot show -create-time <30d
This will yield: all snapshots that are NOT less than 30 days old
2) To find out snapshots in last 30days, use the symbol '>'
cdot:: volume snapshot show -create-time >30d
This will yield: all snapshots that are less than 30 days old
It's confusing, but it works!
Another quick exercise using '>' symbol:
To find out snapshots that is less than a day old
cdot: volume snapshot show -create-time >1d
This will yield: all snapshots that are less than a day old
2. What is the Objective?
The whole objective of determining the snapshots is to find out if we can recover some space,
however if the size of the snapshots are minimal then it doesn’t really help the administrator. In
other words, there is no urgency to remove them even though they have to go.
For example : If I have 100 snapshots with less than 50gb space locked in total, then I wouldn't
be bothered to remove them rather I will try to add disks to the existing aggregate or look for other
alternatives.
To determine the snapshot size: We can use the switch '-size' along with the previous
command to find out the size of the snapshots older than x days and of 'y' amount of size.
cdot:: volume snapshot show -create-time <30d -size >50g
This will yield: all snapshots that are NOT less than 30 days old with size > 50g
You can also use wildcard to sort the same:
For example:
You can use *2018 : To sort snapshots created in 2018.
You can use *vol* : To sort snapshots that contains specific name.
Cdot::volume snapshot show -create-time *2018 -volume *sql_prod*
ashwinwriter@gmail.com
July, 2019