Advancelinux.blogspot.in 2012 02 Configuring on Rhel 6 i
-
Upload
jitendrakasotia9917 -
Category
Documents
-
view
216 -
download
0
Transcript of Advancelinux.blogspot.in 2012 02 Configuring on Rhel 6 i
-
7/28/2019 Advancelinux.blogspot.in 2012 02 Configuring on Rhel 6 i
1/5
Configuring iSCSI target on RHEL 6
Introduction:
iSCSI is Internet SCSI (Small Computer System Interface), 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 makes block devices available via the
network. We can mount block devices (disks) across an IP network to local system and
then use them like any other block device. iSCSI is a client-server protocol. The server-
side is referred to as the 'target,' while the client-side is referred to as the 'initiator.' Both
the target and initiator are uniquely identified by a string called the iSCSI Qualified Name
(iQN). Initiators come in two varieties: software and hardware. A software initiator is just
a driver that handles all requests and pairs the network interfaces driver and the SCSI
drivers together to make it work. Using a software initiator any system with an Ethernetcard can act as an iSCSI initiator. A hardware initiator is an iSCSI HBA, which is basically
just an ethernet card with a SCSI ASIC onboard. Here we are configuring software
initiator in RHEL 6.
OS installation:
Install RHEL 6 on the server with basic server installation and configure yum server on
the machine.
Network setup:
Configure network with ipaddress and make sure that clients are reachable to the server.
By default iSCSI will listen to the port 3260, we have to add necessary rules in iptables to
allow iSCSI. I gnore this step if firewall is disabled.
# iptables -I INPUT -p tcp -m tcp --dport 3260 -j ACCEPT
# service iptables save
# service iptables restart
Install and enable the iSCSI target service:
Install and enable the iSCSI target service with the following commands
# yum install scsi-target-utils
# chkconfig tgtd on
# service tgtd start
Allocate storage for the LUNs:
The iSCSI target service is not dependent on a particular type of exported LUN. The LUNs
can be plain files, LVM volumes, or block devices. There is however a performance
overhead if using the LVM and/or file system layers as compared to block devices. This
example demonstrates the creationof a local partition /dec/sdc1 as iSCSI storage LUN
iSCSI server configuration in RHEL6
Page 1 of 5iSCSI server configuration in RHEL6
4/19/2013http://advancelinux.blogspot.in/2012/02/configuring-on-rhel-6-introduction.html
-
7/28/2019 Advancelinux.blogspot.in 2012 02 Configuring on Rhel 6 i
2/5
# fdisk -l /dev/sdc
Di sk / dev/ sdc: 3221 MB, 3221225472 bytes
255 heads, 63 sector s/ t r ack, 391 cyl i nder s
Uni t s = cyl i nders of 16065 * 512 = 8225280 byt es
Sector si ze ( l ogi cal / physi cal ) : 512 bytes / 512 bytes
I / O si ze (mi ni mum/ opt i mal ) : 512 byt es / 512 byt es
Di sk i dent i f i er : 0xc9a1606e
Devi ce Boot St ar t End Bl ocks I d
Syst em
/ dev/ sdc1 1 391 3140676 83
Li nux
Create the targets:
Targets can be created by adding an XML entry to the /etc/tgt/targets.conffile,
using text editor. Following entries to be added.
#vi /etc/tgt/targets.confdef aul t - dr i ver i scsi
backi ng- st or e / dev/ sdc1
wr i t e- cache of f
Note:
The target attribute requires an iSCSI Qualified Name (IQN),following is the general
format:
iqn.yyyy-mm.reversed.domain.name:OptionalIdentifierText
yyyy-mm represents the 4-digit year and 2-digit month the device was started (for
example: 2011-07)
reversed.domain.name is the hosts domain name in reverse. For example,
server1.example.com, in an IQN, becomes com.example.server1;
OptionalIdentifierText is any text string, without spaces, that helps the administrator
identifies which device.
Restart tgtd service:
Need to restart tgtd service after configuring iscsi target
# service tgtd restart
St oppi ng SCSI t arget
daemon: [ OK ]
St ar t i ng SCSI t ar get
daemon: [ OK ]
Checking configuration:
To confirm the successful operation , query the iSCSI target setup using following
command
Page 2 of 5iSCSI server configuration in RHEL6
4/19/2013http://advancelinux.blogspot.in/2012/02/configuring-on-rhel-6-introduction.html
-
7/28/2019 Advancelinux.blogspot.in 2012 02 Configuring on Rhel 6 i
3/5
# tgt-admin --show
Target 1: i qn. 2008- 09. com. exampl e: ser ver . t ar get 1
System i nf ormati on:
Dr i ver : i scs i
St ate: r eady
I _T nexus i nf ormat i on:
LUN i nf ormat i on:
LUN: 0
Type: cont r ol l er
SCSI I D: I ET 00010000
SCSI SN: beaf 10
Si ze: 0 MB
Onl i ne: Yes
Removabl e medi a: No
Backi ng st ore t ype: r dwr
Backi ng st ore path: None
LUN: 1
Type: di sk
SCSI I D: I ET 00010001
SCSI SN: beaf 11
Si ze: 3216 MB
Onl i ne: Yes
Removabl e medi a: No
Backi ng st ore t ype: r dwr
Backi ng st ore pat h: / dev/ sdc1
Account i nf ormat i on:
ACL i nf ormat i on:
ALL
Client side configuration:
1 ) Install iscsi-initiator-utils package on the client using yum
# yum install iscsi-initiator-utils
2 )Discover the target LUNs exported by server using following command. It will provide
iqn name with of LUN associated with given ip address
# iscsiadm -m discovery -t sendtargets -p 10.30.32.206
Star t i ng i scs i d:
[ OK ]
10. 30. 32. 206: 3260, 1 i qn. 2008-
09. com. exampl e: server . t ar get 1t
Note :
-p : it is indicates the address of target server.
3) To connect iSCSI target we can use following command , we need to mention server
ip and iqn name.
# iscsiadm -m node -T iqn.2008-09.com.example:server.target1 p
10.30.32.206 login
Page 3 of 5iSCSI server configuration in RHEL6
4/19/2013http://advancelinux.blogspot.in/2012/02/configuring-on-rhel-6-introduction.html
-
7/28/2019 Advancelinux.blogspot.in 2012 02 Configuring on Rhel 6 i
4/5
Note :
-p : it is indicates the address of target server.
-T : This option specifies iqn of target server
Now iSCSI target is connected from ip 10.30.32.206.To find out the device associated
with the iSCSI LUN. We have to check /var/log/message
# tail /var/log/messagesDec 26 14: 22: 50 l ocal host ker nel : scsi 3: 0: 0: 0: At t ached scsi
gener i c sg4 t ype 12
Dec 26 14: 22: 50 l ocal host ker nel : scsi 3: 0: 0: 1: Di r ect- Access
I ET VI RTUAL- DI SK 0001 PQ: 0 ANSI : 5
Dec 26 14: 22: 50 l ocal host ker nel : sd 3: 0: 0: 1: At t ached scsi
generi c sg5 t ype 0
Dec 26 14: 22: 50 l ocal host kernel : sd 3: 0: 0: 1: [ sdd] 6281352 512-
byte l ogi cal bl ocks: ( 3. 21 GB/ 2. 99 Gi B)
Dec 26 14: 22: 50 l ocal host ker nel : sd 3: 0: 0: 1: [ sdd] Wr i t e Pr ot ect
i s of f
Dec 26 14: 22: 50 l ocal host kernel : sd 3: 0: 0: 1: [ sdd] Wr i t e cache:di sabl ed, r ead cache: enabl ed, doesn' t suppor t DPO or FUA
Dec 26 14:22:50 localhost kernel: sdd: sdd1
Dec 26 14: 22: 50 l ocal host ker nel : sd 3: 0: 0: 1: [ sdd] At t ached SCSI
di sk
Dec 26 14: 22: 50 l ocal host l i bvi r t d: 14: 22: 50. 833: er r or :
udevGetSCSI Type: 747 : Fai l ed t o f i nd SCSI devi ce t ype 12
Dec 26 14: 22: 50 l ocal host i scsi d: Connect i on1: 0 t o [ t ar get :
i qn. 2008- 09. com. exampl e: server. t arget 1, port al : 10. 30. 32. 206, 3260]
t hr ough [ i f ace: def aul t ] i s oper at i onal now
In this demo, iSCSI LUN is linked as/ ded/ sdd1
Creating file system:
we can create file system on /ded/sdd1 and use locally.
# mkfs.ext3 /dev/sdd1
# mkdir iSCSI
# mount /dev/sdd1 /iSCSI/
Adding entry in /etc/fstab:
Find out UUID of device using following command
# blkid /dev/sdd1/ dev/ sdd1: UUI D="9674832d- c995- 4ac8- b6da-0d25ef a088d0" TYPE="ext 3"
Add the following entry in/et c/ fst abusing vi editor.
UUID= 9674832d-c995-4ac8-b6da-0d25efa088d0 /iSCSI ext3 _netdev 0 0
[ r oot @dhcpserver / ] #cat /etc/fstab
#
# / et c / f st ab
Page 4 of 5iSCSI server configuration in RHEL6
4/19/2013http://advancelinux.blogspot.in/2012/02/configuring-on-rhel-6-introduction.html
-
7/28/2019 Advancelinux.blogspot.in 2012 02 Configuring on Rhel 6 i
5/5
# Cr eated by anaconda on Thu J un 2 00: 41: 38 2011
#
# Accessi bl e f i l esyst ems, by ref er ence, ar e mai nt ai ned under
' / dev/ di sk'
# See man pages f st ab( 5) , f i ndf s( 8) , mount ( 8) and/ or bl ki d( 8) f or
more i nf o
#
/ dev/ mapper / Vol Gr oup- l v_root / ext 4
def aul t s 1 1
UUI D=9c732237- b39f - 4024- a631- 3c264e637179 / boot
ext4 def aul t s 1 2
/ dev/ mapper / Vol Gr oup- l v_swap swap swap
def aul t s 0 0
t mpf s / dev/ shm t mpf s
def aul t s 0 0
devpt s / dev/ pt s devpt s
gi d=5, mode=620 0 0
sysf s / sys sysf s
def aul t s 0 0
pr oc / pr oc pr oc
def aul t s 0 0
UUID=9674832d-c995-4ac8-b6da-0d25efa088d0 /iSCSI ext3
_netdev 0 0
The added entry is highlighted in the above output.
Note:
We must use_netdevparameter while adding entry in /etc/fstab,Which is
used to prevent the system from attempting to mount the file systems until thenetwork has been enabled on the system.
Page 5 of 5iSCSI server configuration in RHEL6
4/19/2013h // d li bl i /2012/02/ fi i h l 6 i d i h l