Friday, January 23, 2015

Configure ISCSI servers & 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. SCSI is very cheap compared to our traditional SAN environment. Using Infiniband interface, we can 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: solsrv-iscsi (Solaris 11)
Client: sol-client (Solaris)

Login to Solaris 11 system which is going to act as an ISCSI server

1. Try to enable stmf service in SMF.
solsrv-iscsi:~# svcadm enable stmf
svcadm: Pattern 'stmf' doesn't match any instances
solsrv-iscsi:~#
2. As per the above command output, stmf (COMSTART storage server) is not installed. Let me install it now.
solsrv-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
solsrv-iscsi:~#
3. Try to enable stmf service and verify the service status.

solsrv-iscsi:~# svcadm enable stmf
solsrv-iscsi:~# svcs stmf
STATE STIME FMRI
online 13:01:31 svc:/system/stmf:default
solsrv-iscsi:~#
4. Create a new zpool to share the storage with other systems.
SOL11-ISCIS:~# zpool create sanpool c1t0d0 c1t2d0
solsrv-iscsi:~# zfs create -V 1g sanpool/LUN1
5. Create a new LUN from the zfs volume using stmfadm.
solsrv-iscsi:~# stmfadm create-lu /dev/zvol/rdsk/sanpool/LUN1
Logical unit created: 600144F0B418030000005281E05C0001
solsrv-iscsi:~#
6. Verify the newly created LUN.
solsrv-iscsi:~# stmfadm list-lu
LU Name: 600144F0B418030000005281E05C0001
solsrv-iscsi:~#
7. Make the LUN to visible over the network. Adding LUN view.
Note: You can also restrict the luns to access specific host.

solsrv-iscsi:~# stmfadm add-view 600144F0B418030000005281E05C0001
solsrv-iscsi:~# stmfadm list-view -l 600144F0B418030000005281E05C0001
View Entry: 0
Host group : All
Target Group : All
LUN : Auto
solsrv-iscsi:~#
8. Enable the ISCSI target service and check the service status.
solsrv-iscsi:~# svcadm enable -r svc:/network/iscsi/target:default
solsrv-iscsi:~# svcs /network/iscsi/target
STATE STIME FMRI
online 13:32:29 svc:/network/iscsi/target:default
solsrv-iscsi:~#
9. Create a new ISCSI target,
solsrv-iscsi:~# itadm create-target
Target iqn.1986-03.com.sun:02:473cb729-b40c-684e-fffe-9cbe01d94f70 successfully created
solsrv-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
solsrv-iscsi:~#
10. If you would like to backup the configuration of COMSTAR, use the below command.
solsrv-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 sol-client which is our client machine.


1. Enable the ISCSI intiator service
root@sol-client:~# svcadm enable network/iscsi/initiator
root@sol-client:~# svcs -a network/iscsi/initiator
svcs: -a ignored when used with arguments.
STATE STIME FMRI
online 10:51:59 svc:/network/iscsi/initiator:default
root@sol-client:~#
2. Add the newly created target using iscsiadm command.
root@sol-client:~# iscsiadm list static-config
root@sol-client:~#
sol-client:~# iscsiadm add static-config iqn.1986-03.com.sun:02:473cb729-b40c-684e-fffe-cbe01d94f70,192.168.2.32:3260
sol-client:~# iscsiadm list static-config
Static Configuration Target: iqn.1986-03.com.sun:02:473cb729-b40c-684e-fffe-9cbe01d94f70,192.168.2.32:3260
sol-client:~#
sol-client:~# 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.
sol-client:~# echo|format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c0t600144F0B418030000005281E05C0001d0 SUN-COMSTAR-1.0 cyl 1022 alt 2 hd 64 sec 32>
/scsi_vhci/disk@g600144f0b418030000005281e05c0001
1. c8t0d0 VMware,-VMware Virtual S-1.0-16.00GB>
/pci@0,0/pci15ad,1976@10/sd@0,0
2. c8t1d0 VMware,-VMware Virtual S-1.0-16.00GB>
/pci@0,0/pci15ad,1976@10/sd@1,0
Specify disk (enter its number): Specify disk (enter its number):
sol-client:~#

 

Solaris 10 Client Discovery Steps:
Enable the discovery:
sol-client:~# iscsiadm modify discovery -s enable
Scan the LUN in OS side.
sol-client:~# devfsadm -i iscsi -v
# echo |format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c0t600144F0B418030000005281E05C0001d0 SUN-COMSTAR-1.0 cyl 1022 alt 2 hd 64 sec 32>
/scsi_vhci/disk@g600144f0b418030000005281e05c0001
1. c8t0d0 VMware,-VMware Virtual S-1.0-16.00GB>
/pci@0,0/pci15ad,1976@10/sd@0,0
2. c8t1d0 VMware,-VMware Virtual S-1.0-16.00GB>
/pci@0,0/pci15ad,1976@10/sd@1,0
Specify disk (enter its number): Specify disk (enter its number):

 

No comments:

Post a Comment