Cloud Articles and Resources

Data ONTAP PowerShell Toolkit - Qtrees and Quotas

views-count 12121 Views

In the NetApp storage model, the basic unit is the RAID group.  RAID groups are combined into pools called Aggregates.  Logical containers called Flexvols are carved from the space in an aggregate.  A Flexvol can contain files or LUNs.  Further, a Flexvol can be partitioned by creating Qtrees in it.

If you’ve worked with QSM or SnapVault, then you’re probably familiar with one use case for Qtrees in conjunction with LUNs.  Qtrees are also common in NFS or CIFS file environments.  Like a directory, a Qtree can be used to further partition space within a volume that contains files.  In these Environments, Qtrees are often used in conjunction with Quotas.

There are three basic types of Quota; the tree, user, and group quota.  A quota can be applied to a volume or a Qtree.  In addition a default quota can be applied to an object, which also applies to all objects beneath the object to which it is applied.  Through quotas, you can set hard, soft, or threshold limits on the number of files of amount of disk space consumed.  A threshold quota is a unique case.  In addition to logging, a threshold quota will send an SNMP trap.

The Data ONTAP PowerShell Toolkit provides several cmdlets for manipulating quotas.  Foremost among them is add-naquota.  To add a default tree quota to the volume vol1, with a DiskLimit of 10GB,

Add-naquota tree * vol1 –DiskLimit 10g

To add a threshold limit of 7GB to the qtree qtree_1 in the volume vol1,

Add-naquota tree /vol/vol1/qtree_1 vol1 –Threshold 7g

To remove the quota from the qtree qtree_1,

Remove-naquota tree /vol/vol1/qtree_1 vol1

To get a report of all quotas,


In addition to working with files if you place your LUNs in qtrees, and then place a quota on the qtree, things start to get real interesting.

More to follow.

Happy Scripting


Please Note:

All content posted on the NetApp Community is publicly searchable and viewable. Participation in the NetApp Community is voluntary.

In accordance with our Code of Conduct and Community Terms of Use, DO NOT post or attach the following:

  • Software files (compressed or uncompressed)
  • Files that require an End User License Agreement (EULA)
  • Confidential information
  • Personal data you do not want publicly available
  • Another’s personally identifiable information (PII)
  • Copyrighted materials without the permission of the copyright owner

Continued non-compliance may result in NetApp Community account restrictions or termination.




I have a script to create a qtree an a CIF share and I set the quota for that qtree as below:


##Craete QTREE

$CreatedQTree = New-NaQtree $Qtree -Controller $VFiler -ErrorAction Stop

##set access rule inheritance

##set audit rule inheritance

#set owner


#set quota

$DiskLimit = $Quota+$Unit
$res = Set-NaQuota -Path $Qtree -DiskLimit $DiskLimit -ErrorAction Stop


After executing I can get the quota using Get-NaQuota and all created configuration looks fine. But if the user (owner) cheks the available quota for that share in windows explorer, the quota that is shown differs from the set quota. It is always 4 GB regardless of quota which was set.


I don't know what the problem is. Does anbody have a idea about the reason of this ptoblem?






Hello @Ramin,


I believe you need to reinitialize quotas (using the cmdlet Start-NaVolQuotaResize) before the changes will take effect.




Hello Andrew,


thx for you reply. In the meantime I found some informations about update handlung of quotas. It seems to me that it is a must to manually do something on volume level bevor a new quata or a change takes effect. It's somehow disappointing to me.


I found following information:


"You can resize (Start-NaVolQuotaResize) quotas when making the following types of changes to the quota rules:

  • Changing an existing quota.

    For example, changing the limits of an existing quota.

  • Adding a quota for a quota target for which a default quota or a default tracking quota exists.
  • Deleting a quota for which a default quota or default tracking quota entry is specified.
  • Combining separate user quotas into one multi-user quota."

 A full quota reinitialization (Disable-NaVolQuota \ Enable-NaVolQuota) is necessary in the following circumstances:

  • Add a new qtree and create a new tree quota for it.
  • ...

For my understanding, I have to disable and enable the quota subsystem for whole volume everytime if I add a new qtree to that volume! We have a provisioning system for a automated creating of user data shares. That means I have to adapt my script in a way to disable and enable the quota subsystem for a volume with hunderts of qtrees, which are in use, each time when we fullfill an order to create a new share! This is a awful solution.


What is your experience in this context? Do you know a better way.







i want to use the Remove-NcQuota Cmdlet to remove user quota entries.


The help says that the parameter qtree is optional, but when i use the cmdlet, the programm says


Remove-NcQuota : Missing input: qtree
At line:1 char:1
+ Remove-NcQuota -Type user
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (nacluster-kh:NcController) [Remove-NcQuota], EAPIMISSINGARGUMENT
+ FullyQualifiedErrorId : ApiException,DataONTAP.C.PowerShell.SDK.Cmdlets.Quota.RemoveNcQuota


My problem is, we have no qtree.

So what should i type in for the parameter qtree?


Any ideas to solve this mess?





Remove-NcQuota -VserverContext vserver_name -Policy policy_name -Volume volume_name -Type user -Target domain\userid -Qtree ""


That's it, thank you very much!Smiley Happy

All Community Forums