Download rpm
apt-get install targetcli
Or install without recommended packages
apt-get install --no-install-recommends targetcli
Create file for datastore
dd if=/dev/zero of=/opt/test1 bs=1024 count=6000000
targetcli
Create datastore on targetcli
cd backstores/fileio
create itest1 /opt/test1 6144000000B
Create iSCSCI target instance
cd /iscsi
create
Map LUN to datastore (based on FILEIO)
cd luns
create /backstores/fileio/itest1
Configure ACL (check WWN in openiscsi section)
cd ../../acls
create
create iqn.1993-08.org.debian:01:dcb3d359cc91
Save configuration
cd /
saveconfig
Disable athentication
cd iscsi/
set set discovery_auth enable=0
cd /iscsi/iqn.2003-01.org.linux-iscsi.sc-azl-001.x8664:sn.8b4b5e8c13a2/tpgt1
set attribute authentication=0
Configure interface
cd portals
create
cd /
saveconfig
All config should looks like:
targetcli
ls
o- / ......................................................................................................... [...]
o- backstores .............................................................................................. [...]
| o- fileio ................................................................................... [1 Storage Object]
| | o- idisk ............................................................................. [/opt/test1 activated]
| o- iblock ................................................................................... [0 Storage Object]
| o- pscsi .................................................................................... [0 Storage Object]
| o- rd_dr .................................................................................... [0 Storage Object]
| o- rd_mcp ................................................................................... [0 Storage Object]
o- iscsi .............................................................................................. [1 Target]
| o- iqn.2003-01.org.linux-iscsi.sc-azl-001.x8664:sn.8b4b5e8c13a2 ........................................ [1 TPG]
| o- tpgt1 ........................................................................................... [enabled]
| o- acls ........................................................................................... [1 ACLs]
| | o- iqn.1993-08.org.debian:01:dcb3d359cc91 ................................................. [1 Mapped LUN]
| | o- mapped_lun0 ............................................................................. [lun0 (rw)]
| o- luns ............................................................................................ [1 LUN]
| | o- lun0 ..................................................................... [fileio/idisk (/home/test1)]
| o- portals ...................................................................................... [1 Portal]
| o- 192.168.42.135:3260 .............................................................................. [OK]
o- loopback ........................................................................................... [0 Target]
o- qla2xxx ............................................................................................ [0 Target]
o- tcm_fc ............................................................................................. [0 Target]
OpeniSCSI installation - client (initiatior)
aptitude install open-iscsi
/etc/init.d/open-iscsi restart
Search target name:
iscsiadm -m discovery -t sendtargets -p 192.168.42.135
Check your initiator name
cat /etc/iscsi/initiatorname.iscsi
## DO NOT EDIT OR REMOVE THIS FILE!
## If you remove this file, the iSCSI daemon will not start.
## If you change the InitiatorName, existing access control lists
## may reject this initiator. The InitiatorName must be unique
## for each iSCSI initiator. Do NOT duplicate iSCSI InitiatorNames.
InitiatorName=iqn.1993-08.org.debian:01:dcb3d359cc91
iscsiadm -m node
Connect to iscsi target:
iscsiadm -m node --targetname "iqn.2003-01.org.linux-iscsi.sc-azl-001.x8664:sn.8b4b5e8c13a2" --portal "192.168.42.135:3260" --login
Verify new block device
dmesg | tail
No comments:
Post a Comment