where do you want these LUNs, love?

Posted by Dick on January 28, 2007

I posted the other day about
Solaris Express ZFS / iSCSI integration .
As I said, there’s no TPGT support in the ZFS offering
yet
so to present targets on specific interfaces you
need to use the iscsitadm commands directly.

As usual, the manpages are good, so treat this as an introduction to them.

start the daemon

The only setup needed is to assign a config directory

vera # svcadm enable iscsitgt
vera # iscsitadm create admin -d /etc/iscsi

make the TPGT

An iSCSI TPGT (Target Portal Group Tag) is just a list of IP addresses.
When you assign a target to the TPGT, you make it reachable on those IPs.

I want my targets on iprb0, so I create a new TPGT and add iprb0s IP address to it.

vera # ifconfig iprb0
....
        inet 1.2.3.4 ....
....
vera # iscsitadm create tpgt 1
vera # iscsitadm modify tpgt -i 1.2.3.4 1
vera # iscsitadm list tpgt -v 1
TPGT: 1
    IP Address: 1.2.3.4

sanity check

You are running a firewall, right? iSCSI is on tcp/3260, so a line like this in /etc/ipf/ipf.conf would be a good idea:

pass in quick on iprb0 proto tcp from iscsiclient to 1.2.3.4 port = 3260 flags S keep state

make the targets

I want eight targets, 2Gb each. So I make a zvol for each, then make a target on it:

vera # zfs create tank/iscsiluns
vera # for i in first second third fourth fifth sixth seventh eighth
do
 zfs create -V 2G tank/iscsiluns/$i
 iscsitadm create target -b /dev/zvol/rdsk/tank/iscsiluns/$i $i
done

The important bit here is the ’-b’ flag to ‘back’ the targets with zvols.

The zvol targets are ‘onlined’ immediately.
By default, iscsitadm backs targets with files.
These are zero-filled before being started, so they take ages to online (and by default
they get created in your ‘admin’ directory which may fill your root filesystem).

vera # iscsitadm list target -v eighth
Target: eighth
    iSCSI Name: iqn.1986-03.com.sun:02:d456321a-e2f9-ca43-8537-88a0d23b4a33.eighth
    Connections: 0
    ACL list:
    TPGT list:
    LUN information:
        LUN: 0
            GUID: 0
            VID: SUN
            PID: SOLARIS
            Type: disk
            Size: 2.0G
            Backing store: /dev/zvol/rdsk/tank/iscsiluns/eighth
            Status: online

add targets to the TPGT

vera # for i in first second third fourth fifth sixth seventh eighth
do
iscsitadm modify target -p 1 $i
done
vera # iscsitadm list target -v eighth
Target: eighth
    iSCSI Name: iqn.1986-03.com.sun:02:d456321a-e2f9-ca43-8537-88a0d23b4a33.eighth
    Connections: 0
    ACL list:
    TPGT list:
        TPGT: 1
    LUN information:
        LUN: 0
            GUID: 0
            VID: SUN
            PID: SOLARIS
            Type: disk
            Size: 2.0G
            Backing store: /dev/zvol/rdsk/tank/iscsiluns/eighth
            Status: online

The volumes are of course still zvols, so you can snapshot/clone them as usual:

vera # zfs list -t volume
NAME                     USED  AVAIL  REFER  MOUNTPOINT
tank/iscsiluns/eighth   36.5K  18.1G  36.5K  -
tank/iscsiluns/fifth    36.5K  18.1G  36.5K  -
tank/iscsiluns/first    36.5K  18.1G  36.5K  -
tank/iscsiluns/fourth   36.5K  18.1G  36.5K  -
tank/iscsiluns/second   36.5K  18.1G  36.5K  -
tank/iscsiluns/seventh  36.5K  18.1G  36.5K  -
tank/iscsiluns/sixth    36.5K  18.1G  36.5K  -
tank/iscsiluns/third    36.5K  18.1G  36.5K  -
Trackbacks

Use this link to trackback from your own site.

Comments

Leave a response

Comments