Data ONTAP PowerShell Toolkit - HOWTO: Work with LUNs and Qtrees

by Frequent Contributor on ‎2010-06-08 01:32 PM

When creating LUNs, it’s generally a best practice to place them in Qtrees.  Fortunately, it’s easy to create Qtrees with Data ONTAP PowerShell Toolkit; just use the New-NaQtree cmdlet:

New-NaQtree /vol/vol1/qt_vol1

Creates a Qtree called “qt_vol1” in the volume “vol1”

Now with the Qtree out of the way, it’s time to create a LUN.  Sure, we could use the toolkit to create a LUN filer side, create an igroup and map it, then rescan the disks (that’s  “rescan” | diskpart  in PowerShell BTW), but then you’d have to give it a drive letter and format it and otherwise do a lot of work.  It’s far easier to just create the LUN using the SnapDrive CLI right from within your PowerShell script.  You’d do something like:

Sdcli disk create –d I:\ -p /vol/vol1/test.lun  -z 10240 –dtype dedicated –rs n –IG MyLaptop igroup_iscsi

This creates a 10GB LUN in vol1 and attaches it as drive I:\ to my laptop via iSCSI with no space reserved for snapshots.  Oops.  I forgot all about that best practice of putting LUNs in Qtrees.  Not to worry; you can use the Rename-NaLun cmdlet to move a LUN

Rename-nalun /vol/vol1/test.lun /vol/vol1/qt_vol1/test.lun

Not a problem.

Well, I just created a Thick LUN.  What if I wanted to thin it?  Easy:

Set-nalunspacereserved /vol/vol1/qt_vol1/test.lun –off

It’s a thin LUN now.  While I’m at it, I’ll enable Dedupe on the volume:

Enable-NaSiS /vol/vol1

John

Comments

Is there a better/native way to do the SLCI command with the latest powershell toolkit?

vinith Former NetApp Employee

You can do that with

Invoke-Nassh "<sdcli cmd>"

You can get detailed help for this cmdlet using

PS C:\Users\vinith> Get-Help Invoke-NaSsh -Detailed

An example below.

C:\PS>Connect-NaController dunn

C:\PS> Invoke-NaSsh aggr status

hi John

i have few 1 tb luns that i would like to move into a separate qtrees

is "lun move" command non disruptive ?

Frequent Contributor

Yes it's non disruptive, but I would use the toolkit.

Rename-nalun /vol/vol1/test.lun /vol/vol1/qt_vol1/test.lun

i created a lun (5gb) and moved into a qtree (2gb).

but the writes did not stop when qtree was full, even tough i did set up hard limit as 2gb.

how can i setup in such a way that when qtree is full, it shouldnt accept any more writes and accept only reads.

Warning!

This NetApp Community is public and open website that is indexed by search engines such as Google. Participation in the NetApp Community is voluntary. All content posted on the NetApp Community is publicly viewable and available. This includes the rich text editor which is not encrypted for https.

In accordance to 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
  • Copyrighted materials without the permission of the copyright owner

Files and content that do not abide by the Community Terms of Use or Code of Conduct will be removed. Continued non-compliance may result in NetApp Community account restrictions or termination.