26
Aug

iSCSI targetcli

   Posted by: admin   in Linux nông dân

#yum install targetcli
#targetcli
/> ls
o- / [...]
o- backstores [...]
| o- block [Storage Objects: 1]
| | o- dev_sdb [/dev/sdb (60.0GiB) write-thru activated]
| | o- alua [ALUA Groups: 1]
| | o- default_tg_pt_gp [ALUA state: Active/optimized]
| o- fileio [Storage Objects: 0]
| o- pscsi [Storage Objects: 0]
| o- ramdisk [Storage Objects: 0]
o- iscsi [Targets: 1]
| o- iqn.2003-01.org.linux-iscsi.iscsid.x8664:sn.bfc48a1cbef2 [TPGs: 1]
| o- tpg1 [no-gen-acls, no-auth]
| o- acls [ACLs: 1]
| | o- iqn.1998-01.com.vmware:3a4fc8a8-5206-a0e0-146c-500100030000-057c77a5 [Mapped LUNs: 1]
| | o- mapped_lun1 [lun1 block/dev_sdb (rw)]
| o- luns [LUNs: 1]
| | o- lun1 [block/dev_sdb (/dev/sdb) (default_tg_pt_gp)]
| o- portals [Portals: 1]
| o- 0.0.0.0:3260 [OK]
o- loopback [Targets: 0]
/>

To create a block backstore from the targetcli shell:

/> cd /backstores/block
/backstores/block> create name=LUN_1 dev=/dev/xvdb

To create a fileio backstore from the targetcli shell:

/> cd /backstores/fileio
/backstores/fileio> create name=LUN_3 /root/disk1.img 5G

To create an iSCSI target

/> cd /iscsi
/iscsi> create

cd tpg1/luns
tpg1/luns> create /backstores/block/LUN_1 lun1

ACLs
cd tpg1/acls
create iqn.1998-01.com.vmware:3a4fc8a8-5206-a0e0-146c-500100030000-057c77a5

/>saveconfig

This entry was posted on Friday, August 26th, 2022 at 12:31 am and is filed under Linux nông dân. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed at this time.