ONTAP Discussions

Scripting SAN volume and LUN creation

Havox

I am trying to script the creation of SAN volume and then a LUN underneath using the CLI.  The first problem is that there is no Storage Type option from the CLI that I can find.  So creating the SAN volume with one command and then creating the LUN with a second command does not seem to be an option.

 

The second issue is if I try to just create the LUN and the volume at the same time using lun create, there is no option to select the aggregate that I want to use.  I want the script to select a particular aggregate for this process.

 

Is there a way to do this without using WFA?  Does Powershell have this capability?  I am running CDOT 8.3.2P4.

 

Thanks,

Jon

2 REPLIES 2

Havox

After doing a little testing it looks like the NFS Storage Type option in System Manager only adds a mount point.  Other than that, the volumes are exactly the same.  I guess I could run the unmount command to remove the mount to make it a "SAN" volume but that seems a bit clunky.

 

Still working on trying to do this using the lun create command...

Havox

Ok, I think I figured this out.

 

It is a two-step process with some prep up front.  My ultimate goal is to be able to provision LUNs using a third-party tool to be used as quick, temporary lab environments.  Here are the steps I went through.

 

Prep work

 

1. Create a separate SVM with vsadmin enabled.  I don't want my script hitting anything but this SVM and I don't want it having system-wide admin privileges.

 

2. The hosts on the other end will have static WWPNs so I created the igroups ahead of time in the new SVM.

 

3. Assign the appropriate aggregates to the SVM using vserver modify command:

 

# vserver modify -vserver <svm_name> -aggr-list <comma-delimited aggregate list>

 

Script - Logged in as vsadmin

 

1. Create the volume.  Note that if you don't use the -policy option, it will not create the mount point which is the only difference from a SAN volume.

 

# vol create -volume <volume_name> -aggregate <aggregate_name> -size <GB,TB> -state online -type RW

 

2. Create the LUN.

 

# lun create -path </vol/volume_name/lun_name> -size <GB,TB> -ostype <os_name> -space-reserve <enabled,disabled> -space-allocation <enabled,disabled>

 

3. Map the LUN.

 

# lun map-path </vol/volume_name/lun_name> -igroup <igroup_name> -lun-id <#>

 

 

 

 

Announcements
Register for Insight 2021 Digital

INSIGHT 2021 Digital: Meet the Specialists 2

On October 20-22, gear up for a fully digital, totally immersive virtual experience with a downright legendary lineup of world-renowned specialists. Tune in for visionary conversations, solution deep dives, technical sessions and more.

NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public