Iscsi Solaris

Don't forget that there is a server and a client side for any iSCSI use.
What does it means for you ? see below…

Server side
is the host that provide a disk to be used with iSCSI protocol.
Client side
is the host that use, as a local disk, the iSCSI disk provided by a remote server.

How to create an iSCSI target on Solaris 10

I will use the method with a zfs volume, but it can also be done with raw partition.
Let's first create a volume of one gigabytes size with zfs1, so do this :

# zfs create -V 1g local-disk/vol-1

where

-V 1g

means that we will create a volume of 1 gigabytes,
within zfs partition :

local-disk

and the new volume name will be :

vol-1

Then, you have to set the volume available to be used for iscsi (other host can use this iscsi disk ), by doing that :

# iscsitadm modify admin --backing-store local-disk/vol-1

And you will be able to create a iscsi target as simply as :
# iscsitadm create target --size 10m asztoto

This command will create an iSCSI target named asztoto of size 10 Mbytes, note that it needs enought space in the volume to create the target.
As it remains space in the volume

vol-1

created with zfs. You can add several iscsi target device as you wish as long as there is enought space in the volume.
So, let's add a second iscsi target named :

my_iscsi_target_2

with this command :

# iscsitadm create target --size 100m my_iscsi_target_2

How to discover and connect to a iscsi target on Solaris 10 (right).

First join the server which have the iscsi target :

iscsiadm add discovery-address IP_ADDRESS;

This command won't produce any output.
To see if the server has some iscsi device available for others, let's do :
iscsiadm list discovery-address -v;

the ouput will be probably something like that :
Discovery Address: 192.168.1.191:3260
        Target name: iqn.2006-01.com.openfiler:oracle.solaris-zfs
                Target address:   192.168.1.191:3260, 1
        Target name: iqn.2006-01.com.openfiler:oracle.lvm-oracle1
                Target address:   192.168.1.191:3260, 1

As you can see, from the remote host :

192.168.1.191

there is 2 iscsi device available, these are :

  1. iqn.2006-01.com.openfiler:oracle.solaris-zfs
  2. iqn.2006-01.com.openfiler:oracle.lvm-oracle1

Now, choose the iscsi that you want to use, I choose this one :

iqn.2006-01.com.openfiler:oracle.lvm-oracle1

Then, to use this iscsi device, do that :

# iscsiadm add static-config NAME_OF_ISCSI_TARGET,IP_ADDRESS_OF_ISCSI_TARGET;

with my example, I would do that :
# iscsiadm add static-config iqn.2006-01.com.openfiler:oracle.lvm-oracle1,192.168.1.191

And now, if all goes properly, you can see the new device if you format it, so check it out with :
# format

So, let's create a partition, and use it with zfs, really a nice tool…

How to share a disk with iSCSI

svcs have to show iscsi initiator, then dicover address of the remote host

you have to check if static-config service is enable. Check this out with :

# iscsiadm list discovery

with a fresh install of solaris, your output will probably looks like this one :
Discovery:
        Static: disabled
        Send Targets: disabled
        iSNS: disabled

if you see this, you won't be able to see the iSCSI drive on your computer, to be able to use it, you only have to enable the static service, so :
# iscsiadm modify discovery --static enable

and the ouput of the previous command will change to :
Discovery:
        Static: enabled
        Send Targets: disabled
        iSNS: disabled

and now, we are able to use the new iSCSI drive, check it out with format if it see the new drive… Format it, and then create a fs to be usable by the system and the users.

** Not really clear **
Note that as iSCSI linux target implementation use only iSCSI type of sendtarget, if you want to use with solaris an iSCSI target created on a Linux host, you have to enable the sendtarget services, let's do that with :

# iscsiadm modify discovery --sendtargets enable

and check the output of the command :
# iscsiadm list discovery

it have to has a line like this one :

Send Targets: enabled

How to disable/delete a iSCSI target

You can list all the available iSCSI target that other system can reach, by doing :

# iscsitadm list target

Here is my output with this command :
Target: iscsi-2
    iSCSI Name: iqn.1986-03.com.sun:02:2dc78e80-6253-435b-aaf4-bd46df498bc2.iscsi-2
    Connections: 1
Target: sandbox
    iSCSI Name: iqn.1986-03.com.sun:02:82a6cb73-6684-c9fb-a7ed-9138e252de23.sandbox
    Connections: 1

This will give you a brief summary, but as we need more detailed data about the iSCSI target, we need to add a flag to the previous command, so let's do it with :
# iscsitadm list target -v

this last command will give you the lun on which the iSCSI target is available. So, the previous output changed to :
Target: iscsi-2
    iSCSI Name: iqn.1986-03.com.sun:02:2dc78e80-6253-435b-aaf4-bd46df498bc2.iscsi-2
    Connections: 1
        Initiator:
            iSCSI Name: iqn.1986-03.com.sun:01:00000000885a.47bbfce5
            Alias: Standby
    ACL list:
    TPGT list:
    LUN information:
        LUN: 0
            GUID: 01000030843b229500002a0047beb39a
            VID: SUN
            PID: SOLARIS
            Type: disk
            Size: 1.0G
            Backing store: /dev/zvol/dsk/local-disk/disk-iscsi-2
            Status: online
Target: sandbox
    iSCSI Name: iqn.1986-03.com.sun:02:82a6cb73-6684-c9fb-a7ed-9138e252de23.sandbox
    Connections: 1
        Initiator:
            iSCSI Name: iqn.1986-03.com.sun:01:00000000885a.47bbfce5
            Alias: Standby
    ACL list:
    TPGT list:
    LUN information:
        LUN: 0
            GUID: 01000030843b229500002a0047beb1ad
            VID: SUN
            PID: SOLARIS
            Type: disk
            Size:   10M
            Status: online

So, now you have all the information needed from this last output to remove an iSCSI target from the system. Find the lun number, here it was :

0

and the target name, here it was :

sandbox

and then execute this command :

# iscsitadm delete target --lun 0 sandbox

And now, you won't see anymore the iSCSI target that you delete, let's check it out with this command :
# iscsitadm list target

if no error occured, the output will be :
Target: iscsi-2
    iSCSI Name: iqn.1986-03.com.sun:02:2dc78e80-6253-435b-aaf4-bd46df498bc2.iscsi-2
    Connections: 1

So, now nobody can use anymore the iSCSI target as it don't exist on our system.

How to disconnect an iSCSI drive from the host

First, list which target are available on the host :

# iscsiadm list target

my ouput was this one :
Target: iqn.1986-03.com.sun:02:ffcf27fb-122d-6665-ee06-ac5b749f0864.sandbox-2
        Alias: sandbox-2
        ISID: 4000002a0000
        Connections: 0
Target: iqn.1986-03.com.sun:02:82a6cb73-6684-c9fb-a7ed-9138e252de23.sandbox
        Alias: sandbox
        ISID: 4000002a0000
        Connections: 0

By instance, if I wanted to disconnect the target with name :

iqn.1986-03.com.sun:02:ffcf27fb-122d-6665-ee06-ac5b749f0864.sandbox-2

what I have to do is :

# iscsiadm remove static-config iqn.1986-03.com.sun:02:ffcf27fb-122d-6665-ee06-ac5b749f0864.sandbox-2
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License