Data Infrastructure Management Software Discussions

Disable snapshot on netapp C mdoe volume using powershell commands

I was looking for command to disable snapshot on a volume but not able to find an option in netapp PS toolkit.

is there a command or options in cmdlet i can set to disable the snapshots on a particular vol?

 

5 REPLIES 5

Re: Disable snapshot on netapp C mdoe volume using powershell commands

Hello @CAPATEL_NET1984,

 

There are two ways you can disable snapshots:

 

  1. Set the snapshot policy to "none"
  2. Set the volume option "nosnap" to "on"

To change the policy, you can use this PowerShell:

 

Update-NcVol -Query @{ Name = $volName } -Attributes @{ VolumeSnapshotAttributes = @{ SnapshotPolicy = "none" } }

To disable the volume option:

 

Get-NcVol $volName | Set-NcVolOption -Key nosnap -Value on

 

You can read more about PSTK + snapshots here and volumes here.

 

Hope that helps!

 

Andrew

If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

View solution in original post

Re: Disable snapshot on netapp C mdoe volume using powershell commands

Take a look at get-ncvol and update-ncvol.  I think the volume attribute you want to update is .NoSnap.  This could also be the option to enable user access to teh snapshot directory, so you will want to test this.  Look at the Example at the end of

 

get-Help Update-NcVol -full   for an example of how to do this.

 

 

 

Re: Disable snapshot on netapp C mdoe volume using powershell commands

Tried in WFA

 

 

erro is below

 

09:58:18.167 ERROR  [LM Disable snapshot for backup volume] Failed executing command. Exception: Modification of the following fields: auto-snapshots-enabled not allowed for volumes of the type "Flexible Volume - Read-Write volume".

 

 

param (
        [parameter(Mandatory=$true, HelpMessage="Cluster IP address")]
        [string]$Cluster,

        [parameter(Mandatory=$true, HelpMessage="Volume name")]
        [string]$VolumeName,

        [parameter(Mandatory=$true, HelpMessage="Storage Virtual Machine name")]
        [string]$VserverName

       
        )

        # connect to controller
        Connect-WfaCluster $Cluster

        #testing volume existence. this command somehow doesn't throw exception if
        # ErrorAction is 'Stop' and the volume isn't found. adding if block
        $vol = Get-NcVol -Name $VolumeName -Vserver $VserverName
        if(!$vol)
        {
        throw "Volume '$VolumeName' not found on Storage Virtual Machine '$VserverName'"
        }

 

Get-WFALogger -Info -message $("Modifying volume: " + $VolumeName + " on Storage Virtual Machine " + $VserverName)


$status = Get-NcVol $VolumeName | Set-NcVolOption -Key nosnap -Value on
#$status = Update-NcVol -Query $queryTemplate -Attributes $attributeTemplate -FlexGroupVolume
  
        if($status.FailureCount -eq 1)
        {
        throw $status.FailureList[0].ErrorMessage
        }
   

Re: Disable snapshot on netapp C mdoe volume using powershell commands

taht query of setting it to none worked, but when i chnage the snapshot policy directly to none in create volume command's inputs in wfa it does not work

 

so I can use another powershell command to set none as SS policy on a volume but i can not use the wfa create volume certified command's in put name snapshot policy and can not set as nonw

Re: Disable snapshot on netapp C mdoe volume using powershell commands

also I ahve differnt code version in lab and prod and i noticed that on older code version 9.1p1 i need to do below, added -FlexGroupVolume:$false and it worekd fine

i did not added this on 9.2 version and it still worked

 


Update-NcVol -Query @{ Name = $VolumeName } -Attributes @{ VolumeSnapshotAttributes = @{ SnapshotPolicy = "none" } } -FlexGroupVolume:$false

 

 

Cloud Volumes ONTAP
Review Banner
All Community Forums
Public