Table of Contents

iSCSI - How to use iSCSI in Linux



iSCSI target

preparation

# yum -y install targetcli
# systemctl enable target.service
# systemctl start target.service

disclosure

# targetcli ls /
# targetcli /backstores/block create name=lun0 dev=/dev/vgdata00/lvdata00
# targetcli /iscsi create iqn.2016-12.com.example:host01
# targetcli /iscsi/iqn.2016-12.com.example:host01/tpg1/luns create /backstores/block/lun0
# cat /etc/iscsi/initiatorname.iscsi 
# targetcli /iscsi/iqn.2016-12.com.example:host01/tpg1/acls create iqn.1994-05.com.redhat:0fa619ccaea
# targetcli ls /
# targetcli saveconfig


iSCSI Initiator

preparation

# yum install iscsi-initiator-utils
# systemctl enable iscsid.service
# systemctl start iscsid.service

Scan iSCSI

# iscsiadm -m discovery -t st -p xxx.xxx.xxx.xxx:3260
# lsblk -S   <- check LUN

Disconnect iSCSI

# iscsiadm -m node    <- Check IQN
# iscsiadm -m node -T iqn.2016-12.com.example:host01 -p xxx.xxx.xxx.xxx --logout