Difference between revisions of "ISCSI target"

From Tom's notes
Jump to navigation Jump to search
(Created page with "=Installation= <source lang="sh"> emerge tgt </source>")
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
=Installation=
+
=Setup=
 +
Install:
 
<source lang="sh">
 
<source lang="sh">
 
emerge tgt
 
emerge tgt
 +
</source>
 +
 +
Start service:
 +
<source lang="sh">
 +
/etc/init.d/tgtd start
 +
rc-update add tgtd default
 +
</source>
 +
 +
Create a target:
 +
<source lang="sh">
 +
tgtadm --lld iscsi --mode target --op new --tid=1 --targetname iqn.2007-01.be.hacks:nexus1
 +
</source>
 +
 +
List targets:
 +
<source lang="sh">
 +
tgtadm --lld iscsi --mode target --op show
 +
</source>
 +
 +
Add a LUN to the target:
 +
<source lang="sh">
 +
tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /dev/vg0/iscsi1
 +
</source>
 +
 +
Grant public access:
 +
<source lang="sh">
 +
tgtadm --lld iscsi --mode target --op bind --tid 1 -I ALL
 +
</source>
 +
 +
Save config
 +
<source lang="sh">
 +
tgt-admin --dump > /etc/tgt/targets.conf
 
</source>
 
</source>

Latest revision as of 00:06, 27 April 2016

Setup

Install:

emerge tgt

Start service:

/etc/init.d/tgtd start
rc-update add tgtd default

Create a target:

tgtadm --lld iscsi --mode target --op new --tid=1 --targetname iqn.2007-01.be.hacks:nexus1

List targets:

tgtadm --lld iscsi --mode target --op show

Add a LUN to the target:

tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /dev/vg0/iscsi1

Grant public access:

tgtadm --lld iscsi --mode target --op bind --tid 1 -I ALL

Save config

tgt-admin --dump > /etc/tgt/targets.conf