ONTAP Discussions

Scripting SAN volume and LUN creation

Havox
3,430 Views

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
3,410 Views

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
3,400 Views

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 <#>

 

 

 

 

Public