2014/06/08

iSCSI Configuration

What is iSCSI 

iSCSI ( Internet Small Computer System Interface ) is an Internet Protocol (IP)-based storage networking standard for linking data storage facilities.

By carrying SCSI commands over IP networks, iSCSI is used to facilitate data transfers over intranets and to manage storage over long distances. iSCSI can be used to transmit data over local area networks (LANs), wide area networks (WANs), or the Internet and can enable location-independent data storage and retrieval.

The protocol allows clients (called initiators) to send SCSI commands (CDBs) to SCSI storage devices (targets) on remote servers. It is a storage area network (SAN) protocol, allowing organizations to consolidate storage into data center storage arrays while providing hosts (such as database and web servers) with the illusion of locally attached disks.

Configure Targets

In Ubuntu 14.04, simple setup: set the target device as a image file, no authentication required, can be connected from IP.
[1]Create a new image file for storage area.

# create an image file of size 20G 

root@dlp:~#
mkdir /storage
dd if=/dev/zero of=/storage/lun1.img bs=1024k count=20000

[2]Configure iSCSI Target
root@dlp:~#
aptitude -y install iscsitarget iscsitarget-dkms
root@dlp:~#
vi /etc/default/iscsitarget
# change

ISCSITARGET_ENABLE=true
root@dlp:~#
vi /etc/iet/ietd.conf
# add at the last line

# naming rule : [ iqn.yaer-month.domain:any name ]

Target iqn.2014-04.world.server:target0
 
# provided devicce as a iSCSI target

    Lun 0 Path=/storage/lun1.img,Type=fileio
 
# Alias

    Alias LUN1
 
# authentication info ( set anyone you like for "username", "password" )

    incominguser username password
root@dlp:~#
/etc/init.d/iscsitarget restart 

 * Removing iSCSI enterprise target devices:          [ OK ]
 * Starting iSCSI enterprise target service           [ OK ]
                                                      [ OK ]
root@dlp:~#
ietadm --op show --tid=1 
# show status

Wthreads=8
Type=0
QueuedCommands=32
NOPInterval=0
NOPTimeout=0


Configure Initiator

Simple Setup: No authentication, assume target IP is 192.168.11.4
[1]Configure iSCSI Initiator
root@www:~#
aptitude -y install open-iscsi
root@www:~#
vi /etc/iscsi/iscsid.conf
# discover target

root@www:~#
iscsiadm -m discovery -t sendtargets -p 192.168.11.4

192.168.11.4:3260,1 iqn.2012-07.world.server:target0
# confirm status after discovery

root@www:~#
iscsiadm -m node -o show 

# BEGIN RECORD 2.0-871 node.name = iqn.2012-07.world.server:target0
node.tpgt = 1
node.startup = manual
iface.hwaddress = <empty>
iface.ipaddress = <empty>
iface.iscsi_ifacename = default
iface.net_ifacename = <empty>
iface.transport_name = tcp
iface.initiatorname = <empty>
...
# END RECORD
# login to target

root@www:~#
iscsiadm -m node --login
...
# confirm session
root@www:~# 
iscsiadm -m session -o show 
tcp: [1] 192.168.11.4:3260,1 iqn.2012-07.world.server:target0
# confirm partitions

root@www:~#
cat /proc/partitions 




Reference

http://www.server-world.info/en/note?os=Ubuntu_12.04&p=iscsi
http://www.howtoforge.com/using-iscsi-on-ubuntu-10.04-initiator-and-target
http://en.wikipedia.org/wiki/ISCSI

No comments:

Post a Comment

Post Code on Blogger

Simplest way to post code to blogger for me: <pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black;overflow-x:...