Home / Solaris11 / How to Configure ISCSI target in Solaris 11 ?

How to Configure ISCSI target in Solaris 11 ?

Solaris 11 has integrated with COMSTAR to configure ISCSI devices. You can easily setup COMSTAR ISCSI target and make the volume available over the network. As you know ISCSI is very cheap compare to our traditional SAN environment.With help of Infiniband interface, I am sure we can definitely match the FC SAN performance on ISCSI devices.Here we will see how to configure Solaris 11 as ISCSI storage server and creating new ISCSI targets for network access.In the end the article, we also how to add the ISCSI targets in Solaris 11 servers (ISCSI initiator).

COMSTAR uses SMF service repository to store its configuration and logical unit mapping.
COMSTAR’s target mode framework runs as stmf in SMF service.

ISCSI Solaris server: SOL11-ISCSI (Solaris 11)
Client: Unixarena (Any host.Here i have shown the example in Solaris)

Login to Solaris 11 system which is going to act a ISCSI server

1.Try to enable stmf service in SMF.

SOL11-ISCSI:~# svcadm enable stmf
svcadm: Pattern 'stmf' doesn't match any instances

2.As per the above command output, stmf(COMSTART storage server) is not installed.Let me install it now.

SOL11-ISCSI:~# pkg install group/feature/storage-server
           Packages to install:  20
       Create boot environment:  No
Create backup boot environment: Yes
            Services to change:   1

DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
Completed                              20/20     1023/1023    54.5/54.5    0B/s

PHASE                                          ITEMS
Installing new actions                     1863/1863
Updating package state database                 Done
Updating image state                            Done
Creating fast lookup database                   Done

3.Try to enable stmf service and verify the service status.

SOL11-ISCSI:~# svcadm enable stmf
SOL11-ISCSI:~# svcs stmf
STATE          STIME    FMRI
online         13:01:31 svc:/system/stmf:default

4.Create a new zpool to share the storage with other systems.

SOL11-ISCIS:~# zpool create sanpool c1t0d0 c1t2d0 
SOL11-ISCSI:~# zfs create -V 1g sanpool/LUN1

5.Create a new LUN from the zfs volume using stmfadm.

SOL11-ISCSI:~# stmfadm create-lu /dev/zvol/rdsk/sanpool/LUN1
Logical unit created: 600144F0B418030000005281E05C0001

6. Verify the newly created LUN.

SOL11-ISCSI:~# stmfadm list-lu
LU Name: 600144F0B418030000005281E05C0001

7.Make the LUN to visible over the network. Adding LUN view.
Note:You can also restrict the luns to access specific host.

SOL11-ISCSI:~# stmfadm add-view 600144F0B418030000005281E05C0001
SOL11-ISCSI:~# stmfadm list-view -l 600144F0B418030000005281E05C0001
View Entry: 0
    Host group   : All
    Target Group : All
    LUN          : Auto

8.Enable the ISCSI target service and check the service status.

SOL11-ISCSI:~# svcadm enable -r svc:/network/iscsi/target:default
SOL11-ISCSI:~# svcs /network/iscsi/target
STATE          STIME    FMRI
online         13:32:29 svc:/network/iscsi/target:default

9.Create a new ISCSI target,

SOL11-ISCSI:~# itadm create-target
Target iqn.1986-03.com.sun:02:473cb729-b40c-684e-fffe-9cbe01d94f70 successfully created
SOL11-ISCSI:~# itadm list-target -v
TARGET NAME                                                  STATE    SESSIONS
iqn.1986-03.com.sun:02:473cb729-b40c-684e-fffe-9cbe01d94f70  online   0
        alias:                  -
        auth:                   none (defaults)
        targetchapuser:         -
        targetchapsecret:       unset
        tpg-tags:               default

10.If you would like to backup the configuration of COMSTAR,use the below command.

SOL11-ISCSI:~# svccfg export -a stmf > /root/stmf.config

Any time you can import the configuration using svccfg import file_name command.

ISCSI Client

Login to Unixarena which is our client machine.
1.Enable the ISCSI intiator service

root@UnixArena:~# svcadm enable network/iscsi/initiator
root@UnixArena:~# svcs -a network/iscsi/initiator
svcs: -a ignored when used with arguments.
STATE          STIME    FMRI
online         10:51:59 svc:/network/iscsi/initiator:default

2.Add the newly created target using iscsiadm command.

root@UnixArena:~# iscsiadm static-config
iscsiadm: invalid subcommand
Usage:  iscsiadm -?,-V
Usage:  iscsiadm add [-?] OBJECT [-?] [operand]
Usage:  iscsiadm list [-?] OBJECT [-?] [operand]
Usage:  iscsiadm modify [-?] OBJECT [-?] [operand]
Usage:  iscsiadm remove [-?] OBJECT [-?] [operand]
For more information, please see iscsiadm(1M)
UnixArena:~# iscsiadm add static-config iqn.1986-03.com.sun:02:473cb729-b40c-684e-fffe-9cbe01d94f70,
UnixArena:~# iscsiadm list static-config
Static Configuration Target: iqn.1986-03.com.sun:02:473cb729-b40c-684e-fffe-9cbe01d94f70,
UnixArena:~# iscsiadm modify discovery --static enable

Command format: iscsiadm add static-config target:iscsi_server_ip:port 

3.Check the new LUN using format command.Solaris 11 scanned the new ISCSI lun and make it visible in format command.But in Solaris 10 , you need to scan it manually.

UnixArena:~# echo|format
Searching for disks...done

       0. c0t600144F0B418030000005281E05C0001d0 SUN-COMSTAR-1.0 cyl 1022 alt 2 hd 64 sec 32>
       1. c8t0d0 VMware,-VMware Virtual S-1.0-16.00GB>
       2. c8t1d0 VMware,-VMware Virtual S-1.0-16.00GB>
Specify disk (enter its number): Specify disk (enter its number):

You can also add the LUN;s in Linux.Here is the example show in redhat linux.

The sad side is that , we can’t use these LUNS in veritas cluster I/O fencing or redhat cluster fencing due to incompatibility of SCSI-3 persistent reservation.Here is the test which i have performed to confirm whether the LUN is supporting SCSI-3 PR or not using vxfentsthdw command which is part of veritas cluster bundle.

root@UnixArena:~# /opt/VRTSvcs/vxfen/bin/vxfentsthdw
Veritas vxfentsthdw version 6.0PR1 Solaris
The utility vxfentsthdw works on the two nodes of the cluster.
The utility verifies that the shared storage one intends to use is
configured to support I/O fencing.  It issues a series of vxfenadm
commands to setup SCSI-3 registrations on the disk, verifies the
registrations on the disk, and removes the registrations from the disk.

******** WARNING!!!!!!!! ********


Do you still want to continue : [y/n] (default: n) y
The logfile generated for vxfentsthdw is /var/VRTSvcs/log/vxfen/vxfentsthdw.log.4890

Enter the first node of the cluster:

Enter the second node of the cluster:

Enter the disk name to be checked for SCSI-3 PGR on node Unixarena in the format:
        for dmp: /dev/vx/rdmp/cxtxdxs2
        for raw: /dev/rdsk/cxtxdxs2
Make sure it is the same disk as seen by nodes Unixarena and Unixarena1

Enter the disk name to be checked for SCSI-3 PGR on node Unixarena1 in the format:
        for dmp: /dev/vx/rdmp/cxtxdxs2
        for raw: /dev/rdsk/cxtxdxs2
Make sure it is the same disk as seen by nodes Unixarena and Unixarena1


Testing Unixarena /dev/rdsk/c0t600144F0B418030000005281E05C0001d0s2 
Unixarena1 /dev/rdsk/c0t600144F0B418030000005281E05C0001d0s2

Evaluate the disk before testing  
........................ No Pre-existing keys
RegisterIgnoreKeys on disk /dev/rdsk/c0t600144F0B418030000005281E05C0001d0s2 
from node Unixarena  Passed
Verify registrations for disk /dev/rdsk/c0t600144F0B418030000005281E05C0001d0s2 
on node Unixarena    Passed
RegisterIgnoreKeys on disk /dev/rdsk/c0t600144F0B418030000005281E05C0001d0s2 
from node Unixarena1 Passed
Verify registrations for disk /dev/rdsk/c0t600144F0B418030000005281E05C0001d0s2 
on node Unixarena1   Passed
Unregister keys on disk /dev/rdsk/c0t600144F0B418030000005281E05C0001d0s2 
from node Unixarena  Passed
Verify registrations for disk /dev/rdsk/c0t600144F0B418030000005281E05C0001d0s2 
on node Unixarena1  Failed

Unregistration test for disk  failed on node Unixarena1.
         Unregistration from one node is causing unregistration of keys from the other node.
        Disk  is not SCSI-3 compliant on node Unixarena1.
        Execute the utility vxfentsthdw again and if failure persists contact
        the vendor for support in enabling SCSI-3 persistent reservations

Removing test keys and temporary files, if any...

As per the above results,you can see the ISCSI luns are not supporting the SCSI-3 PR.
Hope very soon we can expect this work on Solaris 11.

This ISCSI LUN can be used  in all volume manager like SVM,VXVM,LVM and ZFS and it works great.

Please leave a comment if you have any doubt.Thank you for visiting UnixArena.


Leave a Reply

Your email address will not be published. Required fields are marked *