This script only prints the commands needed to uninitialize a iSCSI target in OpenSolaris based OS.
Run it like ./unsharedataset.sh storage/iscsi/nor-atlas
:
+ test -n storage/iscsi/nor-atlas
+ test -n 600144F06FD5CE0000004DC06C000003
+ test -n iqn.1986-03.com.sun:02:55514a4d-a70c-c4ae-a26d-f9a7a665e8ef
+ test xiqn.1986-03.com.sun:02:55514a4d-a70c-c4ae-a26d-f9a7a665e8ef != x-
----
ds target
storage/iscsi/nor-atlas iqn.1986-03.com.sun:02:55514a4d-a70c-c4ae-a26d-f9a7a665e8ef
----
stmfadm offline-target iqn.1986-03.com.sun:02:55514a4d-a70c-c4ae-a26d-f9a7a665e8ef
itadm delete-target iqn.1986-03.com.sun:02:55514a4d-a70c-c4ae-a26d-f9a7a665e8ef
zfs set fi.f-solutions:iqn=- storage/iscsi/nor-atlas
stmfadm remove-tg-member -g storage/iscsi/nor-atlas iqn.1986-03.com.sun:02:55514a4d-a70c-c4ae-a26d-f9a7a665e8ef
stmfadm delete-lu 600144F06FD5CE0000004DC06C000003
stmfadm delete-tg storage/iscsi/nor-atlas
----