1.\" 2.\" The contents of this file are subject to the terms of the 3.\" Common Development and Distribution License (the "License"). 4.\" You may not use this file except in compliance with the License. 5.\" 6.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 7.\" or http://www.opensolaris.org/os/licensing. 8.\" See the License for the specific language governing permissions 9.\" and limitations under the License. 10.\" 11.\" When distributing Covered Code, include this CDDL HEADER in each 12.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. 13.\" If applicable, add the following below this CDDL HEADER, with the 14.\" fields enclosed by brackets "[]" replaced with your own identifying 15.\" information: Portions Copyright [yyyy] [name of copyright owner] 16.\" 17.\" 18.\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved 19.\" Copyright 2017 Nexenta Systems, Inc. 20.\" 21.Dd March 1, 2016 22.Dt STMFADM 8 23.Os 24.Sh NAME 25.Nm stmfadm 26.Nd SCSI target mode framework command line interface 27.Sh SYNOPSIS 28.Nm 29.Cm add-hg-member 30.Fl g Ar host-group 31.Ar initiator Ns ... 32.Nm 33.Cm add-tg-member 34.Fl g Ar target-group 35.Ar target Ns ... 36.Nm 37.Cm add-view 38.Op Fl h Ar host-group 39.Op Fl n Ar lu-number 40.Op Fl t Ar target-group 41.Ar lu-name 42.Nm 43.Cm create-hg 44.Ar group-name 45.Nm 46.Cm create-lu 47.Oo Fl p Ar property Ns = Ns Ar value Oc Ns ... 48.Op Fl s Ar size 49.Ar lu-file 50.Nm 51.Cm create-tg 52.Ar group-name 53.Nm 54.Cm delete-hg 55.Ar group-name 56.Nm 57.Cm delete-lu 58.Op Fl k 59.Ar lu-name 60.Nm 61.Cm delete-tg 62.Ar group-name 63.Nm 64.Cm import-lu 65.Ar lu-file 66.Nm 67.Cm list-hg 68.Op Fl v 69.Oo Ar host-group Oc Ns ... 70.Nm 71.Cm list-lu 72.Op Fl v 73.Oo Ar lu-name Oc Ns ... 74.Nm 75.Cm list-state 76.Nm 77.Cm list-target 78.Op Fl v 79.Oo Ar target Oc Ns ... 80.Nm 81.Cm list-tg 82.Op Fl v 83.Oo Ar target-group Oc Ns ... 84.Nm 85.Cm list-view 86.Fl l Ar lu-name 87.Oo Ar view Oc Ns ... 88.Nm 89.Cm modify-lu 90.Op Fl f 91.Oo Fl p Ar property Ns = Ns Ar value Oc Ns ... 92.Op Fl s Ar size 93.Ar lu-arg 94.Nm 95.Cm offline-lu 96.Ar lu-name 97.Nm 98.Cm offline-target 99.Ar target 100.Nm 101.Cm online-lu 102.Ar lu-name 103.Nm 104.Cm online-target 105.Ar target 106.Nm 107.Cm remove-hg-member 108.Fl g Ar host-group 109.Ar initiator Ns ... 110.Nm 111.Cm remove-tg-member 112.Fl g Ar target-group 113.Ar target Ns ... 114.Nm 115.Cm remove-view 116.Op Fl a 117.Fl l Ar lu-name 118.Ar view Ns ... 119.Sh DESCRIPTION 120The 121.Nm 122command configures logical units within the SCSI Target Mode Framework 123.Pq STMF 124framework. 125The framework and this man page use the following terminology: 126.Bl -tag -width Ds 127.It Sy initiator 128A device responsible for issuing SCSI I/O commands to a SCSI target and logical 129unit. 130.It Sy target 131A device responsible for receiving SCSI I/O commands for a logical unit. 132.It Sy logical unit 133A device within a target responsible for executing SCSI I/O commands. 134.It Sy logical unit number 135The identifier of a logical unit within a target. 136.It Sy host group 137An host group is a set of one or more initiators that are combined for the 138purposes of being applied to a 139.Sy view 140.Pq see below . 141An initiator cannot be a member of more than one host group. 142.It Sy target group 143A target group is a set of one or more SCSI target ports that are treated the 144same when creating a 145.Sy view 146.Pq see below . 147The set of logical units that a particular SCSI initiator can see is determined 148by the combined set of views. 149.Pp 150Each logical unit has a set of view entries, and each view entry specifies a 151target group, host group, and a LUN. 152An initiator from that host group, when connecting through that target group, is 153able to identify and connect to that logical unit using the specified LUN. 154You can use views to restrict the set of logical units that a specific initiator 155can see, and assign the set of LUNs that will be used. 156.It Sy view 157A view defines the association of a host group, a target group, and a logical 158unit number with a specified logical unit. 159Any view entry added to a logical unit must not be in conflict with existing 160view entries for that logical unit. 161A view entry is considered to be in conflict when an attempt is made to 162duplicate the association of any given host, target and logical unit number. 163.El 164.Ss Logical Unit Properties 165The following logical unit properties can be set only when creating LU using 166.Cm create-lu 167subcommand: 168.Bl -tag -width Ds 169.It Sy blk Ns = Ns Ar num 170Specifies the block size for the device. 171The default is 512. 172.It Sy guid Ns = Ns Ar string 17332 hexadecimal ASCII characters representing a valid NAA Registered Extended 174Identifier. 175The default is set by the STMF to a generated value. 176.It Sy meta Ns = Ns Ar path 177Metadata file name. 178When specified, will be used to hold the SCSI metadata for the logical unit. 179There is no default. 180.It Sy oui Ns = Ns Ar string 181Organizational Unique Identifier. 182Six hexadecimal ASCII characters representing the IEEE OUI company ID 183assignment. 184This will be used to generate the device identifier 185.Pq GUID . 186The default is 187.Sy 00144F . 188.It Sy pid Ns = Ns Ar string 18916 bytes ASCII string defining Product ID per SCSI SPC-3. 190This value will be reflected in the Standard INQUIRY data returned for the 191device. 192The default is 193.Sy COMSTAR . 194.It Sy serial Ns = Ns Ar string 195Serial Number. 196Specifies the SCSI Vital Product Data Serial Number 197.Pq page 80h . 198It is a character value up to 252 bytes in length. 199There is no default value. 200.It Sy vid Ns = Ns Ar string 2018 bytes ASCII string defining Vendor ID per SCSI SPC-3. 202This value will be reflected in the Standard INQUIRY data returned for the 203device. 204The default is 205.Sy SUN . 206.El 207.Pp 208The following logical unit properties can be set when creating LU using 209.Cm create-lu 210subcommand or modified using 211.Cm modify-lu 212subcommand: 213.Bl -tag -width Ds 214.It Sy alias Ns = Ns Ar string 215Up to 255 characters, representing a user-defined name for the device. 216The default is the name of the backing store. 217.It Sy mgmt-url Ns = Ns Ar string 218Up to 1024 characters representing a Management Network Address URL. 219More than one URL can be passed as a single parameter by using space-delimited 220URLs enclosed inside a single pair of quotation marks 221.Pq Sy \(dq . 222.It Sy wcd Ns = Ns Sy true Ns | Ns Sy false 223Write-back cache disable. 224Determines write-back cache disable behavior. 225The default is the write-back cache setting of the backing store device 226specified by the 227.Ar lu-file 228argument. 229.It Sy wp Ns = Ns Sy true Ns | Ns Sy false 230Write-protect bit. 231Determines whether the device reports as write-protected. 232The default is 233.Sy false . 234.El 235.Ss Subcommands 236The 237.Nm 238command supports the subcommands listed below. 239.Bl -tag -width Ds 240.It Xo 241.Nm 242.Cm add-hg-member 243.Fl g Ar host-group 244.Ar initiator Ns ... 245.Xc 246Add a host group member to a host group. 247.Pp 248An initiator cannot be a member of more than one host group. 249.Bl -tag -width Ds 250.It Fl g Ns \&, Ns Fl -group-name Ar host-group 251Specifies group name. 252.Ar host-group 253must be an existing group created using the 254.Cm create-hg 255subcommand. 256.El 257.It Xo 258.Nm 259.Cm add-tg-member 260.Fl g Ar target-group 261.Ar target Ns ... 262.Xc 263Add a target group member to a target group. 264.Pp 265A target cannot be a member of more than one target group. 266.Bl -tag -width Ds 267.It Fl g Ns \&, Ns Fl -group-name Ar target-group 268Specifies group name. 269.Ar target-group 270must be an existing group created using the 271.Cm create-tg 272subcommand. 273.El 274.It Xo 275.Nm 276.Cm add-view 277.Op Fl h Ar host-group 278.Op Fl n Ar lu-number 279.Op Fl t Ar target-group 280.Ar lu-name 281.Xc 282Add a logical unit view entry to a logical unit 283.Ar lu-name , 284where 285.Ar lu-name 286is the STMF name for the logical unit as displayed by the 287.Cm list-lu 288subcommand. 289The 290.Cm add-view 291subcommand provides the user with a mechanism to implement access control for a 292logical unit and also provides a means of assigning a logical unit number to a 293logical unit for a given set of initiators and targets. 294A logical unit will not be available to any initiators until at least one view 295is applied. 296Each view entry gets assigned an entry name, which can be used to reference the 297entry in the 298.Cm list-view 299and 300.Cm remove-view 301subcommands. 302.Bl -tag -width Ds 303.It Fl h Ns \&, Ns Fl -host-group Ar host-group 304.Ar host-group 305is the name of an host group previously created using 306.Cm create-hg 307subcommand. 308If this option is not specified, the logical unit will be available to all 309initiators that log in to the STMF framework. 310.It Fl n Ns \&, Ns Fl -lun Ar lu-number 311.Ar lu-number 312is an integer in the range 0-16383 to be assigned to the logical unit for this 313view entry. 314If this option is not specified, a logical unit number will be assigned by the 315STMF framework. 316.It Fl t Ns \&, Ns Fl -target-group Ar target-group 317.Ar target-group 318is the name of a target group previously created using 319.Cm create-tg 320subcommand. 321If this option is not specified, the logical unit will be available through all 322targets. 323.El 324.It Xo 325.Nm 326.Cm create-hg 327.Ar group-name 328.Xc 329Create a host group with the name 330.Ar group-name . 331.Ar group-name 332is a string of Unicode characters with a maximum length of 255. 333The group name must be unique within the STMF system. 334.It Xo 335.Nm 336.Cm create-lu 337.Oo Fl p Ar property Ns = Ns Ar value Oc Ns ... 338.Op Fl s Ar size 339.Ar lu-file 340.Xc 341Create a logical unit that can be registered with STMF. 342.Ar lu-file 343is the file to be used as the backing store for the logical unit. 344If the 345.Fl s 346option is not specified, the size of the specified 347.Ar lu-file 348will be used as the size of the logical unit. 349.Pp 350Logical units registered with the STMF require space for the metadata to be 351stored. 352When a 353.Sy zvol 354is specified as the backing store device, the default will be to use a special 355property of the 356.Sy zvol 357to contain the metadata. 358For all other devices, the default behavior will be to use the first 64k of the 359device. 360An alternative approach would be to use the 361.Sy meta 362property in a 363.Cm create-lu 364subcommand to specify an alternate file to contain the metadata. 365It is advisable to use a file that can provide sufficient storage of the logical 366unit metadata, preferably 64k. 367.Bl -tag -width Ds 368.It Fl p Ns \&, Ns Fl -lu-prop Ar property Ns = Ns Ar value 369Set specified logical unit property. 370Check 371.Sx Logical Unit Properties 372for the list of available properties. 373.It Fl s Ns \&, Ns Fl -size Ar size 374.Ar size 375is an integer followed by one of the following letters, to indicate a unit of 376size: 377.Sy k , m , g , t , p , e , 378specifying kilobyte, megabyte, gigabyte, terabyte, petabyte and exabyte 379respectively. 380.El 381.It Xo 382.Nm 383.Cm create-tg 384.Ar group-name 385.Xc 386Create a target group with the name 387.Ar group-name . 388.Ar group-name 389is a string of Unicode characters with a maximum length of 255. 390The group name must be unique within the STMF system. 391.It Xo 392.Nm 393.Cm delete-hg 394.Ar group-name 395.Xc 396Delete the host group identified by 397.Ar group-name . 398.It Xo 399.Nm 400.Cm delete-lu 401.Op Fl k 402.Ar lu-name 403.Xc 404Delete an existing logical unit that was created using 405.Cm create-lu 406subcommand. 407This effectively unloads the logical unit from the STMF framework. 408Any existing data on the logical unit remains intact. 409.Bl -tag -width Ds 410.It Fl k Ns \&, Ns Fl -keep-views 411Keep view entries for this logical unit. 412.El 413.It Xo 414.Nm 415.Cm delete-tg 416.Ar group-name 417.Xc 418Delete the target group identified by 419.Ar group-name . 420.It Xo 421.Nm 422.Cm import-lu 423.Ar lu-file 424.Xc 425Import and load a logical unit into the STMF that was previously created using 426.Cm create-lu 427subcommand and was then deleted from the STMF using 428.Cm delete-lu 429subcommand. 430On success, the logical unit is again made available to the STMF. 431.Ar lu-file 432is the filename used in the 433.Cm create-lu 434subcommand. 435If this logical unit is using a separate metadata file, the filename in the 436.Sy meta 437property value that was used in the 438.Cm create-lu 439subcommand must be used here. 440.It Xo 441.Nm 442.Cm list-hg 443.Op Fl v 444.Oo Ar host-group Oc Ns ... 445.Xc 446List information for the host group in the system referenced by 447.Ar host-group . 448If 449.Ar host-group 450is not specified, all host groups in the system will be listed. 451.Bl -tag -width Ds 452.It Fl v Ns \&, Ns Fl -verbose 453Display all host group members. 454.El 455.It Xo 456.Nm 457.Cm list-lu 458.Op Fl v 459.Oo Ar lu-name Oc Ns ... 460.Xc 461List information for the logical unit in the system referenced by 462.Ar lu-name . 463If 464.Ar lu-name 465is not specified, all logical units in the system will be listed. 466.Bl -tag -width Ds 467.It Fl v Ns \&, Ns Fl -verbose 468Display verbose information about the logical unit. 469.El 470.It Xo 471.Nm 472.Cm list-state 473.Xc 474List the operational and configuration state of the STMF. 475.It Xo 476.Nm 477.Cm list-target 478.Op Fl v 479.Oo Ar target Oc Ns ... 480.Xc 481List information for the target port in the system referenced by 482.Ar target . 483If target name is not specified, all target ports in the system will be listed. 484.Bl -tag -width Ds 485.It Fl v Ns \&, Ns Fl -verbose 486Display verbose information about the target along with SCSI session information 487for logged-in initiators. 488.El 489.It Xo 490.Nm 491.Cm list-tg 492.Op Fl v 493.Oo Ar target-group Oc Ns ... 494.Xc 495List information for the target group in the system referenced by 496.Ar target-group . 497If 498.Ar target-group 499is not specified, all target groups in the system will be listed. 500.Bl -tag -width Ds 501.It Fl v Ns \&, Ns Fl -verbose 502Display all group members. 503.El 504.It Xo 505.Nm 506.Cm list-view 507.Fl l Ar lu-name 508.Oo Ar view Oc Ns ... 509.Xc 510List the view entry for the logical unit referenced by 511.Ar lu-name . 512If 513.Ar view 514is not specified, all view entries for the specified logical unit will be 515listed. 516.Bl -tag -width Ds 517.It Fl l Ns \&, Ns Fl -lu-name Ar lu-name 518Specify logical unit. 519.El 520.It Xo 521.Nm 522.Cm modify-lu 523.Op Fl f 524.Oo Fl p Ar property Ns = Ns Ar value Oc Ns ... 525.Op Fl s Ar size 526.Ar lu-arg 527.Xc 528Modify attributes of a logical unit created using the 529.Cm create-lu 530subcommand. 531If 532.Fl f 533is not specified, 534.Ar lu-arg 535is interpreted as 536.Ar lu-name. 537.Bl -tag -width Ds 538.It Fl f Ns \&, Ns Fl -file 539If specified, 540.Ar lu-arg 541is interpreted as file name. 542This provides the ability to modify a logical unit that is not currently 543imported into the STMF. 544.It Fl p Ns \&, Ns Fl -lu-prop Ar property 545Modify specified logical unit property. 546See 547.Sx Logical Unit Properties 548for the list of available properties. 549.It Fl s Ns \&, Ns Fl -size Ar size 550.Ar size 551is an integer followed by one of the following letters, to indicate a unit of 552size: 553.Sy k , m , g , t , p , e , 554specifying kilobyte, megabyte, gigabyte, terabyte, petabyte and exabyte 555respectively. 556.El 557.It Xo 558.Nm 559.Cm offline-lu 560.Ar lu-name 561.Xc 562Offline a logical unit currently registered with the STMF. 563.It Xo 564.Nm 565.Cm offline-target 566.Ar target-name 567.Xc 568Offline the specified target. 569.It Xo 570.Nm 571.Cm online-lu 572.Ar lu-name 573.Xc 574Online a logical unit currently registered with the STMF. 575.It Xo 576.Nm 577.Cm online-target 578.Ar target 579.Xc 580Online the specified target. 581.It Xo 582.Nm 583.Cm remove-hg-member 584.Fl g Ar host-group 585.Ar initiator 586.Xc 587Remove specified 588.Ar initiator 589from host group 590.Bl -tag -width Ds 591.It Fl g Ns \&, Ns Fl -group-name Ar host-group 592Specifies group name. 593.Ar host-group 594must be an existing group created using the 595.Cm create-hg 596subcommand. 597.El 598.It Xo 599.Nm 600.Cm remove-tg-member 601.Fl g Ar target-group 602.Ar target 603.Xc 604Remove specified 605.Ar target 606from target group. 607.Bl -tag -width Ds 608.It Fl g Ns \&, Ns Fl -group-name Ar taget-group 609Specifies group name. 610.Ar target-group 611must be an existing group created using the 612.Cm create-tg 613subcommand. 614.El 615.It Xo 616.Nm 617.Cm remove-view 618.Op Fl a 619.Fl l Ar lu-name 620.Ar view Ns ... 621.Xc 622Remove one or more view entries from a logical unit. 623.Bl -tag -width Ds 624.It Fl a Ns \&, Ns Fl -all 625Remove all view entries for this logical unit. 626.It Fl l Ns \&, Ns Fl -lu-name 627Specify logical unit. 628.El 629.El 630.Sh EXAMPLES 631.Bl -tag -width Ds 632.It Sy Example 1 No Creating a Host group with Two Initiator Ports 633The following commands use the 634.Cm create-hg 635and 636.Cm add-hg-member 637subcommands to create a host group and add two initiator ports to that host 638group. 639.Bd -literal 640# stmfadm create-hg HostA 641# stmfadm add-hg-member -g HostA wwn.210105b0000d92d0 642.Ed 643.It Sy Example 2 No Adding a View Entry to a Logical Unit 644The following command uses the 645.Cm add-view 646subcommand to allow access from 647.Sy HostA 648to a logical unit. 649.Bd -literal 650# stmfadm add-view -h HostA 6000AE40C5000000000046FC4FEA001C 651.Ed 652.It Sy Example 3 No Listing a View Entry 653The following command uses the 654.Cm list-view 655subcommand to list all view entries for the specified logical unit. 656.Bd -literal 657# stmfadm list-view -l 6000AE40C5000000000046FC4FEA001C 658View Entry: 0 659 Host group : HostA 660 Target group : All 661 LUN : 0 662.Ed 663.El 664.Sh INTERFACE STABILITY 665.Sy Committed 666.Sh SEE ALSO 667.Xr attributes 7 , 668.Xr sbdadm 8 669