Array Setup and Networking
cancel
Showing results for 
Search instead for 
Did you mean: 

Command Line Creating Volumes

SOLVED
Go to solution
vmw9
Frequent Advisor

Command Line Creating Volumes

what are the command lines to create a volume for 10, 10GB nimble volumes?

6 REPLIES
rwilliams72
Occasional Visitor
Solution

Re: command line creating volumes

Hi Tony,

A basic one line script to create 10 volumes of 10GB each named vol1 – vol10 use the following:

for i in {1..10};do vol --create vol-$i --size 10240;done

If you wanted to add more volumes (e.g vol00 – vol29) use the following:

for i in {0..2}:do for h in {0..9};do vol --create vol-$i$h --size 10240;done;done

You could also add additional options such as --perfpolicy name,--initiatorgrp name and --multi_initiator yes aswell if you wanted to add performance policies, initiator groups etc to the volumes.

Thanks,
Rod.

alexbcu125
Occasional Contributor

Re: Command Line Creating Volumes

Hi Rod -

Nice script and thank you.  How can I add different sizes for each volume?  ie: Volume1 = 10GB , Volume2 = 20GB I can't seem to get the below script to work:

for x in {F..G};do for y in {5..6};do vol --create T-AlexSQL-$x --size $y0 --perfpolicy default --initiatorgrp vmfs --multi_initiator yes;done;done

Thanks,

Alex

aherbert23
Trusted Contributor

Re: Command Line Creating Volumes

Enclose $y in braces, e.g. ${y}0. Bash is interpreting the 0 as part of the variable name. But you're also going to have a problem that the volume names will conflict based on how your loop is constructed.

mattlavergne26
Occasional Visitor

Re: Command Line Creating Volumes

Great script.

do you know of any way to add more than one initiator group from cli when creating the vol?

mattlavergne26
Occasional Visitor

Re: Command Line Creating Volumes

I found I can add the second initiation with this script

do vol --addacl volname --initiatorgrp igname

but was unable to find any way to bake the second IG into the vol create command.

aherbert23
Trusted Contributor

Re: Command Line Creating Volumes

That would be the way to do it. You can't add multiple IGs in the volume creation command.