Manually Creating Volumes and LUNs in ONTAP CLI

Note: The version here is 9.16.1 since that is what my customer is running, but things won't change much in older/newer ONTAP versions.

Carrying on from the previous post - Creating an iSCSI SVM and LUN in NetApp ONTAP System Manager 9.16.1 - where we created a LUN in ONTAP System Manager (which created a volume for the LUN and also mapped the LUN to an igroup). Now we create the 1) volume, 2) volume settings, 3) LUN mapping using the ONTAP CLI.

1) Volume Creates

For my 30TB LUN:

  • I create a volume 10% bigger = 33TB
  • Max-autosize is 50% bigger = 45TB

Volume create:

volume create
 -vserver                  VSERVER~NAME
 -volume                   VOLUME~NAME
 -aggregate                AGGREGATE~NAME
 -size                     33TB
 -security-style           UNIX
 -max-autosize             45TB
 -autosize-mode            grow
 -space-guarantee          none
 -percent-snapshot-space   0
 -snapshot-policy          SNAPSHOT~POLICY
 -snapshot-locking-enabled true

volume create -vserver VSERVER~NAME -volume VOLUME~NAME -aggregate AGGREGATE~NAME -size 33TB -security-style UNIX -max-autosize 45TB -autosize-mode grow -space-guarantee none -percent-snapshot-space 0 -snapshot-policy SNAPSHOT~POLICY -snapshot-locking-enabled true

Note: The above are the settings I'll use for my customer with names redacted (they use tamperproof snapshots)

2) LUN Creates

LUN create:

lun create
 -vserver          VSERVER~NAME
 -volume           VOLUME~NAME
 -lun              LUN~NAME
 -size             30TB
 -t                windows
 -space-reserve    enabled
 -space-allocation enabled

lun create -vserver VSERVER~NAME -volume VOLUME~NAME -lun LUN~NAME -size 30TB -t windows -space-reserve enabled -space-allocation enabled


3) LUN Mapping Creates

LUN mapping create:

lun mapping create
 -vserver VSERVER~NAME
 -volume  VOLUME~NAME
 -lun     LUN~NAME
 -igroup  IGROUP~NAME
 -lun-id  LUN~ID

lun mapping create -vserver VSERVER~NAME -volume VOLUME~NAME -lun LUN~NAME -igroup IGROUP~NAME -lun-id LUN~ID


Note: In the Appendix below I've had to replace < and > with { and }.

APPENDIX 1) ::> volume create ?


cluster1::} volume create -?
  [ -vserver {vserver name} ]                              Vserver Name (default: vs_iscsi)
   [-volume] {volume name}                                 Volume Name
  { [[-aggregate] {aggregate name}]                        Aggregate Name
  | [ -aggr-list {aggregate name}, ... ]                   List of Aggregates for FlexGroup
                                                           Constituents
    [ -aggr-list-multiplier {1..1000} ]                    Aggregate List Repeat Count
    [ -optimize-aggr-list {true|false} ]                   Have the System Optimize the Order of the
                                                           Aggregate List
  | [ -auto-provision-as {FlexGroup} ]                     Automatically Provision as Volume of Type
    [ -support-tiering {true|false} ]                      Automatically Provision FlexGroup on
                                                           FabricPools
    [ -use-mirrored-aggregates {true|false} ]              Automatically Provision FlexGroup on
                                                           Mirrored Aggregates
    [ -encryption-type {none|volume|aggregate|mixed} ]     Encryption Type
    [ -nodes {nodename}, ... ] }                           List of Nodes Hosting the Volume
  [ -size {{integer}[KB|MB|GB|TB|PB]} ]                    Volume Size
  [ -state {online|restricted|offline|force-online|force-offline|mixed} ]
                                                           Volume State (default: online)
  [ -policy {text} ]                                       Export Policy (default: default)
  [ -user {user name} ]                                    User ID
  [ -group {group name} ]                                  Group ID
  [ -security-style {security style} ]                     Security Style
  [ -unix-permissions {unix perm} ]                        UNIX Permissions (default: ---rwxr-xr-x)
  [ -junction-path {junction path} ]                       Junction Path
  [ -comment {text (size 0..1023)} ]                       Comment
  { [ -max-autosize {{integer}[KB|MB|GB|TB|PB]} ]          Maximum Autosize
    [ -min-autosize {{integer}[KB|MB|GB|TB|PB]} ]          Minimum Autosize
    [ -autosize-grow-threshold-percent {percent} ]         Autosize Grow Threshold Percentage
    [ -autosize-shrink-threshold-percent {percent} ]       Autosize Shrink Threshold Percentage
    [ -autosize-mode {off|grow|grow_shrink} ]              Autosize Mode
    { [ -space-slo {none|thick|semi-thick} ]               Space SLO
    | [ -space-guarantee|-s {none|volume} ]                Space Guarantee Style
      [ -type {RW|DP} ] }                                  Volume Type (default: RW)
  [ -snapdir-access {true|false} ]                         Snapshot Directory Access Enabled
                                                           (default: true)
  [ -percent-snapshot-space {percent} ]                    Space Reserved for Snapshot Copies
  [ -snapshot-policy {snapshot policy} ]                   Snapshot Policy (default: default)
  [ -language {language_code} ]                            Language
  [ -foreground {true|false} ]                             Foreground Process (default: true)
  [ -nvfail {on|off} ]                                     NVFAIL Option
  [ -constituent-role {Constituent Roles} ]                Constituent Volume Role
  { [ -qos-policy-group {text} ]                           QoS Policy Group Name
  | [ -qos-adaptive-policy-group {text} ] }                QoS Adaptive Policy Group Name
  [ -caching-policy {text} ]                               Caching Policy Name
  [ -snaplock-type {non-snaplock|compliance|enterprise} ]  SnapLock Type
  [ -vserver-dr-protection {protected|unprotected} ]       Vserver DR Protection
  [ -encrypt {true|false} ]                                Enable or Disable Encryption
  [ -is-space-reporting-logical {true|false} ]             Logical Space Reporting
  [ -is-space-enforcement-logical {true|false} ]           Logical Space Enforcement
  [ -tiering-policy {Tiering Policy} ]                     Volume Tiering Policy (default: none)
  [ -tiering-object-tags {text}, ... ]                     Tags to be Associated with Objects Stored
                                                           on a FabricPool
  [ -storage-efficiency-mode {default|efficient} ]         Storage Efficiency Mode
  [ -analytics-state {Analytics State} ]                   File System Analytics State (default:
                                                           off)
  [ -activity-tracking-state {Activity Tracking State} ]   Activity Tracking State (default: off)
  [ -key-manager-attribute {text} ]                        Key Manager Attribute
  [ -anti-ransomware-state {disabled|enabled|dry-run|paused|dry-run-paused|enable-paused|disable-in-progress} ]
                                                           Anti-ransomware State (default: disabled)
  [ -granular-data {disabled|basic|advanced} ]             Granular data (default: disabled)
  [ -snapshot-locking-enabled {true|false} ]               Enable Snapshot Copy Locking (default:
                                                           false)
  [ -is-large-size-enabled {true|false} ]                  Are Large Size Volumes and Files Enabled
  [ -in-consistency-group {true|false} ]                   If this Volume is part of a Consistency
                                                           Group

APPENDIX 2) ::> lun create ?


cluster1::} lun create ?
  [ -vserver {vserver name} ]                  Vserver Name (default: vs_iscsi)
   { [-path] {path}                            LUN Path
   |  -volume {volume name}                    Volume Name
    [ -qtree {qtree name} ]                    Qtree Name (default: "")
     [-lun] {text (size 1..255)} }             LUN Name
   { [-size|-s] {san_size}                     LUN Size
  | [ -file-path|-f {text (size 1..255)} ]     File Path
   [-ostype|-t] {LUN Operating System Format}  OS Type
  [ -space-reserve {enabled|disabled} ]        Space Reservation (default: enabled)
  [ -comment {text (size 0..254)} ]            Comment
  [ -space-allocation {enabled|disabled} ]     Space Allocation (default: enabled)
  [ -class {regular|protocol-endpoint|vvol} ]  Class (default: regular)
  { [ -qos-policy-group {text} ]               QoS Policy Group
  | [ -qos-adaptive-policy-group {text} ] }    QoS Adaptive Policy Group
  [ -caching-policy {text} ]                   Caching Policy Name
  [ -foreground {true|false} ]                 Foreground
  [ -igroup-name {text (size 1..96)} ]         Igroup
  [ -initiators {text}, ... ]                  Igroup Initiators

APPENDIX 3) ::> lun mapping create ?


cluster1::} lun mapping create ?
  [ -vserver {vserver name} ]        Vserver Name (default: vs_iscsi)
   { [-path] {path}                  LUN Path
   |  -volume {volume name}          Volume Name
    [ -qtree {qtree name} ]          Qtree Name (default: "")
     [-lun] {text} }                 LUN Name
   [-igroup|-g] {text (size 1..96)}  Igroup Name
  [[-lun-id] {0..4095}]              LUN ID


Comments