Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using powershell, can we find out the year,month,date of the snapshots under each volume and delete only the old snapshots > 120 days old.
8 REPLIES 8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can try something like this.
#Set a new variable of date type which is 120 days before the current date
$120days = (get-date).adddays(-120)
#Get list of all snapshots older than 120 days and delete them ( i have put an whatif parameter to check and confirm)
Get-Ncvol | Get-NcSnapshot | where-object { $_.created -lt $120days } | remove-ncsnapshot -whatif
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for quick response. sorry to trouble with few more questions.. 🙂
1) if we run the PS script from Oncommand /DFM server against the filer, does it use dfm based user account ? or we need to supply filer accounts explicitly?
2) Already have PS installed in the server,Do we need to have admin rights in the windows server to add the Data ontap PS modules?
3) is there anyway we can ignore deletion of mirror and snapvault base snapshots eventhough older?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Siva,
Answers below.
1) if we run the PS script from Oncommand /DFM server against the filer, does it use dfm based user account ? or we need to supply filer accounts explicitly?
You need to supply the filer accounts to establish connection
2) Already have PS installed in the server,Do we need to have admin rights in the windows server to add the Data ontap PS modules?
Yes you would need admin rights to install pstoolkit.
3) is there anyway we can ignore deletion of mirror and snapvault base snapshots eventhough older?
You would need to filter out these snapshots by their naming conventions.
Thanks,
Vinith
Please remember to mark solved if you feel your query is answered.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I see Vinith has given you the cDot cmdlets.. Are you running cDot or 7-mode..
Also - I've written something that will report on your entire environment, not delete, that is easy to add..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks we are using 7 mode.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Siva then you would need to replace "Nc" with "Na" in the example i gave you, all 7-Mode cmdlets are of type "Na" and "Nc" is for cDOT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also, you want to query non-snapmirrored volumes, since you can't delete snaps on read-only volume.
I'll start you with this query
Get-NaVol | ? {$_.state -eq "online" -and $_.raidstatus -notmatch "read-only"}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have two NetApp Clustered OnTAP sites with SnapVault relationships running between them. I am using SMVI at both sites to create crash consistent backups of my VM's contained within the volumes/datastores and then SnapVault them cross-site. In order for the SnapVault to work I need to have SnapShots enabled. The labels are configured as VSC_DAILY_BACKUP and VSC_WEEKLY_BACKUP. By doing this however this creates daily and weekly 'non-crash-consistent' snapshots. The only snapshots that I need are the SMVI daily and SMVI weekly ones. I suspect that I am unable to get away from having the normal NetApp volume snapshots (daily, weekly). Is there a post backup script that can be run for each SMVI backup job that lists and deletes all non-smvi snapshots?
