Thursday, May 15, 2014

Creating iSCSI LUN Visible by Selected Node.


This restrict selected targets visible to initiator i.e. host group and selected LUN for particular target.
This is one of the best practice when provision LUN.

  • 1. Create ZFS pool.
zpool create db-pool c0t600A0B800056405E0000621E530C68E7d0
zpool add -f db-pool c0t600A0B800056405E000049EF5253ECF4d0

  • 2. create zfs disk/volume
zfs create -V 4g db-pool/dbvot1
  • 3. Make ZFS volume LUN
stmfadm create-lu /dev/zvol/rdsk/db-pool/dbvot1

  • 4. Enable scsi initiator (on all the isci client node)
svcadm enable network/iscsi/initiator
svcs -l iscsi/initiator ##check

  • 5. iscsiadm list initiator-node [all client node]

The highlighted section will be used in the next command. Sample principle apply for FC WWN.

  • 6. stmfadm create-hg host-db #[iscsi server node]
  • 7. stmfadm add-hg-member -g host-db

  • 8. stmfadm create-tg target-racdb00
Create target group

  • 9. Create the iSCSI
#itadm create-target

  • 10. itadm list-target v

  • 11. PrimayNode #stmfadm offline-target
Need to make target offline, if it online. See screenshot above.

  • 12. PrimayNode #stmfadm add-tg-member -g target-racdb00
Add “iscsi target” to the target group

  • 13. PrimayNode #stmfadm list-lu v
Check available iSCSI LUN.

Can you create ZFS iSCSI

SCSI LUN created in step 1 to 3.

  • 14. PrimayNode # stmfadm add-view -h host-db -t target-racdb00 -n 10 600144F000212834D270536B68270002
Adding LUN to host group and target group.

  • 15. PrimaryNode #stmfadm list-view -l 600144F000212834D270536B68270002

  • 16. Bring logical unit online.
PrimaryNode #stmfadm online-target

  • 17. Activate client’s initiator
root@dbnode1:~# iscsiadm list discovery
root@dbnode1:~# iscsiadm modify discovery -t enable

  • 18. Add iSCSI address and port(default is 3260)
root@dbnode1:~# iscsiadm add discovery-address

  • 19. root@dbnode1:~# iscsiadm list target

  • 20. Dynamically update /dev and /devices.
root@dbnode1:~# devfsadm v

  • 21. root@dbnode1:~# format

Other Cheat Commands:
  • 1. delete logical unit view
stmfadm remove-view -l 600144F000212834D270536B68270002 0
  • 2. stmfadm à SCSI Target Mode Framework