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.

vol_mgmt_1

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

Snapshots

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.

FlexClones

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.

6 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!

      Andrew

  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!

      Andrew

Leave a Reply