[COLUG] iscsi notes
Jim Wildman
jim at rossberry.com
Wed Jul 30 23:43:52 EDT 2008
Here is the contents of the cheet sheet I presented. I'm going to blend
these into the presentation document. I'll also post the scripts I was
using, once I put my lab back together here at the house.
--
code is based on open-iscsi
The machines doing the sharing are called targets and must be RHEL5.1
(tech
preview) or 5.2 (supported).
The machines doing the mounting are called initiators and can be RHEL4.5
or
5.x. Note that there are significant differences in the command set
between
4.5 and 5.x. These instructions assume 5.x.
On the target machines, install scsi-target-utils
service tgtd restart
chkconfig tgtd on
Locate a suitable disk and then do...
# create the TID (target id) and the iqn (iscsi qualified name)
# as far as I can tell the name is free form, but there is a 'standard'
# iqn.<date valid>.tld.domain.something:diskN
tgtadm --lld iscsi --op new --mode target --tid 2 -T
iqn.2008-05.private.800lab.x335154:disk2
# attach a disk partition to 'back it' as a lun
# can be any block device
tgtadm --lld iscsi --op new --mode logicalunit --tid 2 --lun 1 -b
/dev/sdb1
# 'bind' it, or create an acl to allow a specific ip to access it
# ALL means unrestricted. You can also do CHAP authentication
tgtadm --lld iscsi --op bind --mode target --tid 2 -I 10.100.0.145
# this assumes you have 2 nics and are going to do multipathing
tgtadm --lld iscsi --op bind --mode target --tid 2 -I 10.128.164.145
# printout the result
tgtadm --mode target --op show
on the initiator
yum install iscsi-initiator-utils
echo "InitiatorAlias=a_name" >> /etc/iscsi/initiatorname.iscsi
service iscsid restart
chkconfig iscsid on
then for each target
iscsiadm -m discovery -st -p <ip of target>
grab the iqn and 'login' with it
iscsiadm -m node -T <iqn> -p <ip of target> -l
fdisk -l should show the new disk
if multipathd is running, and you repeat the -l command with the same
iqn, but the other ip, then mulitpathd should join them up according to
the rules you have setup (/etc/multipath.conf)
the iscsiadm commands maintain a persistent store of info in
/var/lib/iscsi.
To release a disk, use -u (instead of -l) or -o delete to remove it from
/var/lib/iscsi
Once the disks are attached, you can use them for md volumes, lvm, or
raw partitions. If you put them in fstab, use the _netdev option so
they will get mounted AFTER the network starts. Can't use for system
files, etc for obvious reasons.
# as far as I can tell the name is free form, but there is a 'standard'
tgtadm --lld iscsi --op new --mode target --tid 2 -T
iqn.2008-05.private.800lab.x335154:disk2
# attach a disk partition to 'back it' as a lun
tgtadm --lld iscsi --op new --mode logicalunit --tid 2 --lun 1 -b
/dev/sdb1
# 'bind' it, or create an acl to allow a specific ip to access it
tgtadm --lld iscsi --op bind --mode target --tid 2 -I 10.100.0.145
tgtadm --lld iscsi --op bind --mode target --tid 2 -I 10.128.164.145
# printout the result
tgtadm --mode target --op show
tgtadm --mode target --op show
Target 2: iqn.2008-05.private.800lab.x335154:disk2
System information:
Driver: iscsi
Status: running
I_T nexus information:
I_T nexus: 1
Initiator: iqn.1994-05.com.redhat:9c24f350284
Connection: 0
IP Address: 10.100.0.145
I_T nexus: 2
Initiator: iqn.1994-05.com.redhat:9c24f350284
Connection: 0
IP Address: 10.128.164.145
LUN information:
LUN: 0
Type: controller
SCSI ID: deadbeaf2:0
SCSI SN: beaf20
Size: 0
Backing store: No backing store
LUN: 1
Type: disk
SCSI ID: deadbeaf2:1
SCSI SN: beaf21
Size: 136G
Backing store: /dev/sdb1
Account information:
ACL information:
10.100.0.145
10.128.164.145
on the initiator
Jim Wildman
Linux Server Engineering
------------------------------------------------------------------------
Jim Wildman, CISSP, RHCE jim at rossberry.com http://www.rossberry.com
"Society in every state is a blessing, but Government, even in its best
state, is a necessary evil; in its worst state, an intolerable one."
Thomas Paine
More information about the colug432
mailing list