Tag Archives: NetApp

Delete multiple NetApp HCI / Solidfire volume snapshots with PowerShell

If you ever need to delete multiple volume snapshots from a NetApp HCI / Solidfire storage array, you will quickly realize there isn’t an efficient way of doing this using the UI – unfortunately you can’t delete multiple snapshots at the same time and each delete request requires a confirmation. Plus if you have a lot of volume snapshots, you will need to search for the snapshot you want to delete every time.

Using PowerShell simplifies the whole process.

First generate a snapshot report using following script.

connect-sfcluster CLUSTER IP

Get-SFSnapshot | select Name, SnapshotID, CreateTime, ExpirationTime, VolumeID, VolumeName | Export-Csv c:\temp\all-snapshots.csv

Sort the resulting CSV file (all-snapshots.csv) by VolumeName then by CreateTime – and highlight the rows including snapshots you want to delete. Then remove all the other rows. Finally remove all columns except the SnapshotID column and save as a new CSV (snapshots-to-delete.csv).

Now run the following script pointing at the new CSV file to delete the snapshots in one go.

$oldsnaps = (Import-Csv 'c:\temp\snapshots-to-delete.csv').SnapshotID

foreach ($snap in $oldsnaps){

Remove-SFSnapshot -SnapshotID $snap -Confirm:$False

}

For more info on how to install the SolidFire PowerShell module and other programmatic approaches to managing NetApp HCI storage – visit my other blog post.

Managing NetApp HCI / Solidfire storage with PowerShell scripting

Just a few scripts I put together in preparation for a migration project which involves NetApp HCI iSCSI storage.

The same PowerShell modules work with Solidfire arrays as well.

Instructions on how to install the PowerShell modules and use them are in the following links.

https://blog.netapp.com/getting-started-with-powershell-for-netapp-hci/

https://github.com/solidfire/PowerShell/blob/master/Install/NetApp_SolidFire_PowerShell_Tools_v1.5.1_User_Guide.pdf

https://github.com/solidfire/PowerShell/blob/master/Install/NetApp_SolidFire_PowerShell_Tools_v1.5.1_Release_Notes.pdf

Use the following script to create multiple volumes.

CSV should include a single column with header “Name” followed by volume names.

Volume name example:

BOOT-LUN-esx011

$Account = Get-SFAccount esxiboot

$QoSPolicy = Get-SFQoSPolicy -Name qos-policy-1

$Volumes = (Import-CSV C:\temp\volumes.csv).Name

foreach ($Volume in $Volumes)
	{
         New-SFVolume -Name $Volume -AccountID $Account.AccountID -TotalSize 7 -GB - 
         Enable512e:$true -QosPolicy $QoSPolicy.QoSPolicyID
}
Continue reading