Skip to content

Instantly share code, notes, and snippets.

@tomfanning
Created November 15, 2017 15:12
Show Gist options
  • Save tomfanning/6b36ea0d0f6c0ca6890d032cfe732d33 to your computer and use it in GitHub Desktop.
Save tomfanning/6b36ea0d0f6c0ca6890d032cfe732d33 to your computer and use it in GitHub Desktop.
Create an iSCSI target on ZFS on CentOS 7
zfs create -o volblocksize=32k -V 10G tslpool/iscsi1
zfs set sync=disabled tslpool/iscsi1
targetcli
block/ create name=block_backend dev=/dev/zvol/tslpool/iscsi1
cd /iscsi
create iqn.2017-11.com.mydomain.ad.zfstest:iscsidisk1
cd /iscsi/iqn.2017-11.com.mydomain.ad.zfstest:iscsidisk1/tpg1/acls
# create acl with the initiator (client) name here, not the one you just created
create iqn.1991-05.com.microsoft:dc1.ad.mydomain.com
cd iqn.1991-05.com.microsoft:dc1.ad.mydomain.com
set auth userid=user
set auth password=12to16characters
cd /iscsi/iqn.2017-11.com.mydomain.ad.zfstest:iscsidisk1/tpg1/luns
create /backstores/block/block_backend
cd /
ls
saveconfig
exit
systemctl enable target.service
systemctl restart target.service
firewall-cmd --permanent --add-port=3260/tcp
firewall-cmd --reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment