NetApp PowerShell Toolkit 101: Managing Volumes

Volumes are the containers of data in a NetApp storage system. They are “stored” on aggregates, accessed via Storage Virtual Machines, and are the point-of-application for many of the features of Data ONTAP. Let’s look at what we can do with volumes leveraging the PowerShell Toolkit:

  • Creating, Deleting, and Re-sizing Volumes
  • Volume Features
    • Thin Provisioning
    • Deduplication
    • Compression
    • AutoGrow / AutoShrink
    • Fractional Reserve
    • Quality of Service
  • Volume Options
  • Snapshots
  • FlexClones
  • Volume Move

IMPORTANT! It is VERY IMPORTANT that you are mindful of the SVM context for most of these commands. If you have two volumes with the same name in different SVMs, and you don’t specify the SVM, the action will affect both. This is no different than the CLI, where you must provide the SVM to be modified.

I am not specifying the SVM with most of the commands against volumes for the sake of brevity, however please, please (please!) keep this in mind as you perform actions against your volumes.

For any action which affects volumes, there will be a parameter named “VserverContext”. This is the parameter that you will want to specify:

This command can now, safely, be pipelined into others which modify properties.

Creating, Deleting, and Resizing Volumes

Creating a volume is an easy enough operation and works very similarly to the CLI.

We can also modify volume properties using the NPTK:

If your volume is a SnapMirror source volume, remember that the destination will increase it’s size as well.

Volume Features

  • Thin Provisioning
  • Deduplication
  • Compression
  • AutoGrow / AutoShrink
  • Fractional Reserve
    Fractional reserve is the amount of volume space that is reserved for LUN writes when a snapshot is taken. It is only applicable when the volume contains one or more LUNs. In recent versions of Data ONTAP there are only two available values: 0% and 100%.

  • Quality of Service
    QoS was added to clustered Data ONTAP 8.2 and is an extremely helpful feature for a couple of reasons. One of those is the obvious ability to limit the amount of IOPS or throughput that a volume can use. The other less obvious use is workload characterization. QoS collects many statistics about the monitored workload and can report information like IO size, R/W mix, and much more.

    Assigning a QoS policy to a volume is not quite so graceful, so let’s create a couple of functions to make it easier:

    And now, with our functions, we can show, add, and remove QoS Policy Groups from volumes easily.

Volume Options

Setting volume options allows you to customize the volume to particular applications and uses. Let’s look at showing, getting, and setting some options.

All of the options you would normally modify at the command line can be manipulated using PowerShell.


For most NFS volumes which are serving VMware datastores, here are the settings I use:


Snapshots are the core principle behind NetApp data protection technology. They are instant, have no performance penalty, and can be reverted to at any time quickly and easily.


A FlexClone is a copy of a volume based on a snapshot that usually consumes no additional space, except for new and changed data. It is a writable instance of the data that is contained in the volume at the time of the snapshot. They are particularly useful for testing and development where you can snapshot the production data, FlexClone it to a writable volume, and then do test/dev with real, production data. Combining this with QoS creates the ability to do this without affecting performance for the production environment.

Splitting a FlexClone is an operation that happens when you want to separate the cloned instance from the original. It is useful when you want to create a full copy of the data for any reason.

Remember that you can not delete the base snapshot of a volume with a FlexClone child until either the clone has been split, or the clone has been destroyed (it is managed just like a regular volume).

Volume Moves

Volume moves are a feature of clustered Data ONTAP (they aren’t available in 7-mode), and are a feature that fundamentally changes how storage administration is done. Using volume move operations it’s possible to vacate controllers, disk shelves, and aggregates to allow non-disruptive maintenance and lifecycle operations.

13 thoughts on “NetApp PowerShell Toolkit 101: Managing Volumes”

  1. When executing Remove-NCLunMap and Set-NcVol -offline through PowerShell, you get a Yes/No/Cancel prompt box. Is there any options to force these commands to execute without prompts?

    • Hi Todd,

      Thanks for reading!

      You should be able to avoid the message by using the parameter -Confirm:$false with the cmdlets.

      Hope that helps!


  2. Hi, thanks for the great article. I am new to PS and I am trying to automate the collcetion of “space used” of a certain volume with date and time on a daily basis and write append it to csv or better xls. I managed to create the script, but not with date and time added. xls should look like this: “date”,”time”,”Volume”,”VolumeSize”,”TotalUsed”. Sounds easy, but I just cannot manage to add date and time . What I have so far ist: 1. $outfile= c:\path 2. get-navolspace -Name volumename | Select-Object Volume,VolumeSize,TotalUsed | Export-csv $outfile -NoTypeInformation -Append . Any hints?

    • Hi Thomas,

      At the simplest you should be able to do something like this:

      Get-NaVolSpace -Name volumename | Select-Object @{'N'="date"; 'E'={ Get-Date }},Volume,VolumeSize,TotalUsed | Export-csv $outfile -NoTypeInformation -Append

      Hope that helps!


  3. Thank you for the great article! It is informative and very well laid out. I am new to Powershell and had a question. I have to create a large number of volumes. I have a file with all the variable ($volumeName, $aggrname, $volSize, Etc.). How can I use this file to create volumes using your create a volume script?

    Thank you!

  4. I wanted to know if I can list things like snapshot policy, snapvault policy and snapvault target volume name as well as snapmirro policy and info regarding that for a volume. all command I can find does not give all info regarding a volume , I want to see if I can get commands which can give volume , its snapshot, its snapvault, its snapmirror, its export policy/rule info

  5. @Andrew This site has been a beacon in trying to understand how to interact with the NetApp via powershell, but as others (read: mgmt) have learned of some of the capability they tasked me with trying to ‘find’ out a few things to make administration more automated like:

    Enabling users to create their own volumes, qtrees, and quotas

    While not crazy about it I have to see if it is actually feasible & I think the fundamental answer is yes.

    This would of course all go through an API call, but would call the new-ncvol command with certain parameters (like aggregate, vservercontext, efficiencypolicy, junctionpoint=$name, etc??) already set – maybe a template would work??

    But for things like volume name (junction point would equal their input name) and size they could input this information (with some limitation/restriction; still trying to figure that one out).

    Is that possible & easy to do?

    Honestly I think it would be better to have a default volumes and allow them to create qtrees for their projects and then set quotas that they could manage. That way i can use get-ncquota / get-ncquotareport to show them the values via JSON on a nice web interface with links to be able to manage the quota from another API.

    Am I off my rocker? Is there a better way of allowing the end users to better create/manage space on the filer using the PowerShell toolkit and APIs?

    • I know this is a year down the track…but we have recently fired up NetApp Workflow Automation. My goodness it works a treat and takes a LOAD of work off our guys, while keeping naming conventions, replication policies and snapshot policies all set correctly. I’d definitely look at that as another option.

  6. Hi Andrew, I am trying to put together a script to perform a volume move post volume move validation and aggregate space utilization pre-checks. Post the volume move is in progress im trying to send status of volume moves and while its done send the completion status.

    Let me know if you have any ideas or thoughts that might help me give the final touch. I have made some logic and trying to get it validated with you. Just so that you are aware i wanted you to know that im not a scripting or automation expert but i can do basic scripting only 🙂

  7. How do I use the command
    Set-NcSnapshotSnaplockExpTime -volume victor_2019_test -Snapshot daily.2020-06 -Expirytime 06/14/2020

    when I run it on my script I get the following error
    Set-NcSnapshotSnaplockExpTime : No such file or directory
    At H:\test_snaplock_etime.ps1:38 char:1
    + Set-NcSnapshotSnaplockExpTime -volume victor_2019_test -Snapshot dail …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (durarcclu01:NcController) [Set-NcSnapshotSnaplockExpTime], EAPIERROR
    + FullyQualifiedErrorId : ApiException,DataONTAP.C.PowerShell.SDK.Cmdlets.Snapshot.SetNcSnapshotSnaplockExpTime


Leave a Reply