### ISCSI Server ±¸¼º ######
1. targetcli ¼³Ä¡
# yum -y install targetcli
2. º¸Á¶½ºÅ丮Áö ÀúÀå¼Ò(ÆÄÀÏ°ú block) »ý¼º
# targetcli
/> cd /backstores
/backstores> fileio/ create file1 /root/disk1_file1 100M
/backstores> block/ create block1 /dev/target_vg/target_lv
=> LV¸¦ µî·ÏÇÏ´Â °úÁ¤
/backstores> block/ create block2 /dev/sdb
3. ´ë»óÀÇ IQN »ý¼º
/> cd /iscsi
/iscsi> create iqn.2019-07.theko.shareLUN01
=> IQN À̸§À» »ý¼ºÇÏ´Â °ÍÀÓ
4. TPG1¿¡ ´ëÇÑ ACL»ý¼º
/iscsi> cd iqn.2019-07.theko.shareLUN01/
/iscsi/iqn.20...7.theko.shareLUN01> cd tpg1/
/iscsi/iqn.20...shareLUN01/tpg1> acls/ create iqn.2015-04.com.example:desktopX
==> Ŭ¶óÀ̾ðÆ® "iqn.2015-04.com.example:desktopX" ¸¸ Á¢¼Ó°¡´ÉÇÏ°Ô Çϴ°ÍÀÓ
±âº»ÀûÀ¸·Î ACLÀÌ ¸ðµÎ ¸·ÇôÀֱ⶧¹®¿¡ ¸ðµÎ ¿¾î Á൵ µÊ.
===================================================================
±âº»ÀûÀ¸·Î ACLÀÌ Àû¿ëµÈ »óÅÂÀε¥ ÀÌ°ÍÀ» ÀÎÁõ¾øÀÌ ÀÚÀ¯·Ó°Ô ÀÌ¿ëÇÒ¼ö ÀÖµµ·Ï ÇÏ´Â ¼³Á¤ÀÌ´Ù.
- disable authentication
/iscsi/iqn.20...1:server/tpg1> set attribute authentication=0
Parameter authentication is now '0'.
- "ignore ACLs mode"
/iscsi/iqn.20...1:server/tpg1> set attribute generate_node_acls=1
Parameter generate_node_acls is now '1'.
- enable read/write mode
/iscsi/iqn.20...1:server/tpg1> set attribute demo_mode_write_protect=0
Parameter demo_mode_write_protect is now '0'.
====================================================================
5. file ¹× Block ¿¡´ëÇÑ LUN»ý¼º
/iscsi/iqn.20...shareLUN01/tpg1> luns/ create /backstores/fileio/file1
Created LUN 0. ==> 0°³°¡ ¾Æ´Ï¶ó ¼ø¹øÀ» ¾ê±âÇϴ°ÍÀÓ
/iscsi/iqn.20...shareLUN01/tpg1> luns/ create /backstores/block/block1
Created LUN 1.
/iscsi/iqn.20...shareLUN01/tpg1> luns/ create /backstores/block/block2
Created LUN 2.
6. Portal »ý¼º (¼¹öÀÇ ifÁÖ¼Ò·Î »ý¼º)
/iscsi/iqn.20...shareLUN01/tpg1> portals/ create 10.65.10.130
==> ÀÌ°ÍÀº ¾ÈÇصµ 0.0.0.0 À¸·Î ¼³Á¤µÇ¾î ¸ðµç ´ë¿ªÀÌ °¡´ÉÇÏ°Ô µÊ
######### Client Server ¼³Á¤ ##############
1. Æ÷Åа˻ö
# iscsiadm -m iscsiadm -m discovery -t sendtargets -p 10.65.10.130:3260
2. Æ÷ÅÐ ·Î±×ÀÎ
# iscsiadm -m iscsiadm -m node -T "iqn.2019-07.theko.shareLUN01" -p 10.65.10.130:3260 -l
3. ¿µ±¸³ëµå ·¹ÄÚµå È®ÀÎ
# cd /var/lib/iscsi/nodes/
4. ¿¬°á²÷±â
# iscsiadm -m node -T "iqn.2019-07.theko.shareLUN011" -p 10.65.10.130:3260 -u
# iscsiadm -m node -T "qn.2019-07.theko.shareLUN01" -p 10.65.10.130:3260 -o delete(¿µ±¸)