In SAN storage systems, Lio is an efficient tool for transforming storage devices directly into available storage resources, enabling the Iscsitarget interface and CLI to create storage devices based on file/block device/ramdisk or even loopback devices. Typical scenarios and joins for accessing Iscsitarget via Iscsiinitiator as indicated:
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/82/FD/wKiom1dn49KzhEujAAMDcvI2nJE043.png "title=" Iscsi_ Structuer.png "alt=" Wkiom1dn49kzheujaamdcvi2nje043.png "/>
It is very intuitive to display data streams based on RAM,/dev/devices, and files to create Iscsitarget. If you look further down, you can see that the interface to the underlying file system and volume management is as follows:
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/82/FC/wKioL1dn5ATD03SZAACig3_OBpg732.png "title=" linux_ Storage_stack_base_lio_iscsi.png "alt=" Wkiol1dn5atd03szaacig3_obpg732.png "/>
Once you've clarified the application and software tiers of iSCSI, it's easy to understand how to create iscsitarget devices and understand why
Before data transfer, the Iscsiinitiator and iSCSI target devices need to be connected.
Below is an example of how to create a iscsitarget, establish iSCSI links, and use iSCSI resources in a Linux operating system using specific commands. You first need to create a target with TARGETCLI on the machine on which the storage resource is mounted:
[[email protected]] #targetcli/backstores/block Create My_ssd/dev/disk/by-id/wwn-0x55cd2e404b7b8ced-part5
\createdblock Storage Object MY_SSD using/dev/disk/by-id/wwn-0x55cd2e404b7b8ced-part5.
[[Email protected]]# TARGETCLI/ISCSI Create
Createdtarget iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.beb1fd396120.
CREATEDTPG 1.
Globalpref Auto_add_default_portal=true
Createddefault Portal listening on all IPs (0.0.0.0), Port 3260.
[[Email protected]]# targetcli/iscsi/iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.beb1fd396120/tpg1/lunscreate /backstores/block/my_ssd
Createdlun 0.
Youhave New Mail In/var/spool/mail/root
[[email protected]] #targetcli/iscsi/iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.beb1fd396120/tpg1set Attribute Authentication=0 Demo_mode_write_protect=0generate_node_acls=1
Parameterauthentication is now ' 0 '.
Parameterdemo_mode_write_protect is now ' 0 '.
Parametergenerate_node_acls is now ' 1 '.
[[email protected]] #targetcli saveconfig myssd.config
Configurationsaved to Myssd.config
The above command also saves the current configuration to the file Myssd.config, after the machine restarts, you can also from this file
Revert to the current settings so that you can avoid the need to re-enter the above command:
[[email protected]] #targetcli clearconfig confirm=true
Allconfiguration cleared
If the file name is not set above, it will be saved to the/etc/target/saveconfig.json file by default.
[[email protected]] #targetcli restoreconfig myssd.config
Next, you need to connect to the target terminal on the initiator side, first detect if there is no iSCSI can be found, if found automatically connected up:
[Email protected]plxsdk]# iscsiadm-m discovery-t st-p 10.10.2.33-l
Loggingin to [Iface:default, target:iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.beb1fd396120, Portal : 10.10.2.33,3260] (multiple)
Loginto [Iface:default, target:iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.beb1fd396120, Portal : 10.10.2.33,3260] successful.
You can see one more device from the/dev device:
LRWXRWXRWX.1 Root root 9 June 20:19ip-10.10.2.33:3260-iscsi-iqn.2003-01.org.linux-iscsi.localhost.x8664: Sn.beb1fd396120-lun-0->. /.. /sdr
This proves that the iscsitarget has been mapped to the INITIATOR/DEV/SDR device, and read and write access to the/DEV/SDR at the initiator end, which is equivalent to 10.10.2.33 on the remote/dev/disk/by-id/machine Wwn-0x55cd2e404b7b8ced-part5 to read and write.
Of course, when you're done, you can disconnect using the following command:
[Email protected]plxsdk]# iscsiadm-m session-u
Loggingout of Session [Sid:1, TARGET:IQN.2003-01.ORG.LINUX-ISCSI.LOCALHOST.X8664:SN.B5928F6012DB, Portal : 10.10.2.33,3260]
Loggingout of Session [Sid:2, target:iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.beb1fd396120, Portal : 10.10.2.33,3260]
Finally run the test program, the following vdbench as an example, to start testing:
[Email protected]vdbench]# cat Ssd_param &&./vdbench-f ssd_param-k-ossd_vdbench.out
Sd=sd2,lun=/dev/sdr,openflags=o_direct,size=500m,threads=24
wd=wd1,xfersize=4k,rdpct=0,seekpct=100
Rd=rd1,wd=wd1,sd=*,iorate=max,elapsed=5,interval=1,warmup=5,threads=24
vdbenchdistribution:vdbench504
Fordocumentation, see ' vdbench.pdf '.
20:25:40.991created output directory '/home/vdbench_qichao/ssd_vdbench.out '
20:25:41.021input argument scanned: '-fssd_param '
20:25:41.021input argument scanned: '-K '
20:25:41.021input argument scanned: '-ossd_vdbench.out '
20:25:41.153starting slave:/home/vdbench/vdbench slavejvm-m localhost-nlocalhost-10-160620-20.25.40.968-l Localhost-0-P 5570
20:25:41.627all Slaves is now connected
20:25:43.001starting Rd=rd1; I/O rate:uncontrolled MAX; Elapsed=5 warmup=5; Forloops:threads=24
20:25:54.068vdbench execution completed successfully. Output Directory:/home/vdbench/ssd_vdbench.out
Reference Documents and Links:
Http://linux-iscsi.org/wiki/Targetcli
Http://www.linux-iscsi.org/Doc/LIO%20Admin%20Manual.pdf
This article from "Storage Chef" blog, reproduced please contact the author!
SSD-based iSCSI target setup and Vdbench testing