This example is using snv66 for the target, and Solaris 10u3 for the initiator, as iSCSI target isn't in Solaris 10u3 (11/06), but is in from u4 (08/07). This should work fine on Solaris 10 u4 and beyond.

Many thanks to Ryan Matteson's excellent notes

* On the target create zfs 'volume' which will be the backing store (our exported disk)

zfs create -V 50g tank/iscsivol000

  • create iscsi 'base' directory (config store)

iscsitadm modify admin -d /etc/iscsitgt

  • create iscsi target

iscsitadm create target -b /dev/zvol/dsk/tank/iscsivol000 target-label

  • list the targets so far if you want...

iscsitadm list target -v

  • If there are more than one interface, and you want to bind to a particular one, add a tpgt...

iscsitadm create tpgt 1 iscsitadm modify tpgt -i 10.101.90.136 1 iscsitadm modify target -p 1 target-label

  • checkout the client host's initiator...

iscsiadm list initiator-node

root@host ~ # iscsiadm list initiator-node Initiator node name: iqn.1986-03.com.sun:01:ac7812f012ff.45ed6c53

  • create an alias for that initiator back on our target (server)...

iscsitadm create initiator -n iqn.1986-03.com.sun:01:ac7812f012ff.45ed6c53 suitable-alias

  • add an acl to the target...

iscsitadm modify target -l suitable-alias target-label

* on the initiator: list discovery modes...

root@host ~ # iscsiadm list discovery Discovery: Static: disabled Send Targets: disabled iSNS: disabled

  • sendtargets discovery enable

iscsiadm modify discovery --sendtargets enable

  • and list...

root@host ~ # iscsiadm list discovery Discovery: Static: disabled Send Targets: enable iSNS: disabled

  • add a discovery address (our target server)

iscsiadm add discovery-address IP.ADD.RES.SS

NOTE: must be IP address

  • show what's exported

iscsiadm list target

[snip]

LUN: 0 Vendor: SUN Product: SOLARIS OS Device Name: /dev/rdsk/c3t0100001B2BC4078001002A0046AEE439d0s2

  • enable the device...

devfsadm -Cv -i iscsi

  • see what's there...

root@host ~ # echo | format Searching for disks...done

AVAILABLE DISK SELECTIONS: 0. c2t0d0 /pci@7b,0/pci1022,7458@11/pci1000,3060@2/sd@0,0 1. c2t1d0 /pci@7b,0/pci1022,7458@11/pci1000,3060@2/sd@1,0 2. c3t0100001B2BC4078001002A0046AEE439d0 /scsi_vhci/disk@g0100001a4ba4078000002a0046b6e439 Specify disk (enter its number): Specify disk (enter its number):

  • manage with zfs

root@host ~ # zpool list NAME SIZE USED AVAIL CAP HEALTH ALTROOT tank 62G 17.2G 44.8G 27% ONLINE - root@host ~ # zpool create iscsitank c3t0100001B2BC4078001002A0046AEE439d0 root@host ~ # zpool list NAME SIZE USED AVAIL CAP HEALTH ALTROOT iscsitank 49.8G 53.5K 49.7G 0% ONLINE - tank 62G 17.2G 44.8G 27% ONLINE -

  • do some stuff

root@host ~ # zfs create iscsitank/test root@host ~ # zfs set mountpoint=none iscsitank root@host ~ # zfs set mountpoint=/test iscsitank/test root@host ~ # zfs list | grep iscsi iscsitank 120K 49.0G 25.5K none iscsitank/test 24.5K 49.0G 24.5K /test

  • Removing a target On the client, unmount/zpool destroy the drive

root@host ~ # iscsitadm list target -v root@host ~ # iscsitadm delete target -u 0 target-tgt0

where -u is LUN ID.


Comments

comments powered by Disqus