In: Aashish
16 Feb 2010Article by Aashish
Storage resource located on an iSCSI server known as a “target”. An iSCSI target usually represents nothing but hard disk storage. As with initiators, software to provide an iSCSI target is available for most mainstream operating systems.
iSCSI initiator (client)
An initiator functions as an iSCSI client. An initiator typically serves the same purpose to a computer as a SCSI bus adapter would, except that instead of physically cabling SCSI devices (like hard drives and tape changers), an iSCSI initiator sends SCSI commands over an IP network.
Debian / Ubuntu Linux Install tgt
Type the following command to install Linux target framework user-space tools:
$ sudo apt-get install tgt
CentOS / RHEL / Red Hat Linux Install tgt
RHEL 5.2 and older version do not have tgt tools. However, RHEL 5.3 (preview version) comes with tgt tools.
tgtadm – Linux SCSI Target Administration Utility
tgtadm is used to monitor and modify everything about Linux SCSI target software: targets, volumes, etc. This tool allows a system to serve block-level SCSI storage to other systems that have a SCSI initiator. This capability is being initially deployed as a Linux iSCSI target, serving storage over a network to any iSCSI initiator.
Start tgtd
To start the tgtd, enter:
# /usr/sbin/tgtd
Under RHEL 5.3 to start the tgtd service, enter:
# /etc/init.d/tgtd start
Define an iscsi target name
The following example creates a target with id 1 (the iqn is 19 iqn.2001-04.com.example:storage.disk2.amiens.sys1.xyz) and adds a 20 logical unit (backed by /dev/hdc1)with lun 1.
# tgtadm –lld iscsi –op new –mode target –tid 1 -T iqn.2001-04.com.example:storage.disk2.amiens.sys1.xyz
To view the current configuration, enter:
# tgtadm –lld iscsi –op show –mode target
Sample output:
Target 1: iqn.2001-04.com.example:storage.disk1.amiens.sys1.xyz
System information:
Driver: iscsi
Status: running
I_T nexus information:
LUN information:
LUN: 0
Type: controller
SCSI ID: deadbeaf1:0
SCSI SN: beaf10
Size: 0
Online: No
Poweron/Reset: Yes
Removable media: No
Backing store: No backing store
Account information:
ACL information:
Add a logical unit to the target (/dev/sdb1):
# tgtadm –lld iscsi –op new –mode logicalunit –tid 1 –lun 1 -b /dev/sdb1
Note:- about home computer / test system
Most production boxes will only use iSCSI root with real iSCSI devices, but for testing purposes it can be quite useful to set up an iSCSI target on your image server. This is useful for testing and learning iSCSI target and iSCSI initiator at home, simply use filesystem for testing purpose. Use dd command to create diskbased filesystem:
# dd if=/dev/zero of=/fs.iscsi.disk bs=1M count=512
Add /fs.iscsi.disk as a logical unit to the target:
# tgtadm –lld iscsi –op new –mode logicalunit –tid 1 –lun 1 -b /fs.iscsi.disk
Now, you should able to view details:
# tgtadm –lld iscsi –op show –mode target
Sample output:
Target 1: iqn.2001-04.com.example:storage.disk1.amiens.sys1.xyz
System information:
Driver: iscsi
Status: running
I_T nexus information:
LUN information:
LUN: 0
Type: controller
SCSI ID: deadbeaf1:0
SCSI SN: beaf10
Size: 0
Online: No
Poweron/Reset: Yes
Removable media: No
Backing store: No backing store
LUN: 1
Type: disk
SCSI ID: deadbeaf1:1
SCSI SN: beaf11
Size: 512M
Online: Yes
Poweron/Reset: Yes
Removable media: No
Backing store: /fs.iscsi.disk
Account information:
ACL information:
Accept iSCSI Target
To enable the target to accept any initiators, enter:
# tgtadm –lld iscsi –op bind –mode target –tid 1 -I ALL
This should open network port # 3260:
# netstat -tulpn | grep 3260
Sample output:
tcp 0 0 0.0.0.0:3260 0.0.0.0:* LISTEN 27328/tgtd
tcp6 0 0 :::3260 :::* LISTEN 27328/tgtd
And you are done. Your system is configured as iSCSI Target. Remote client computer can access this computers hard disk over network. Your can use cluster aware filesystem to setup real shared storage for small business. Open TCP port 3260 in your firewall, if required.
For Client
Install Required Package
iscsi-initiator-utils RPM package – The iscsi package provides the server daemon for the iSCSI protocol, as well as the utility programs used to manage it. iSCSI is a protocol for distributed disk access using SCSI commands sent over Internet Protocol networks. This package is available under Redhat Enterprise Linux / CentOS / Fedora Linux and can be installed using yum command:
# yum install iscsi-initiator-utils
A note about Debian / Ubuntu Linux
If you are using Debian / Ubuntu Linux install open-iscsi package, enter:
$ sudo apt-get install open-iscsi
iSCSI Configuration
There are three steps needed to set up a system to use iSCSI storage:
1. iSCSI startup using the init script or manual startup. You need to edit and configure iSCSI
via /etc/iscsi/iscsid.conf file
2. Discover targets.
3. Automate target logins for future system reboots.
4. You also need to obtain iSCSI username, password and storage server IP address (target host)
Step # 1: Configure iSCSI
Open /etc/iscsi/iscsid.conf with vi text editor:
# vi /etc/iscsi/iscsid.conf
Setup username and password:
node.session.auth.username = My_ISCSI_USR_NAME
node.session.auth.password = MyPassword
discovery.sendtargets.auth.username = My_ISCSI_USR_NAME
discovery.sendtargets.auth.password = MyPassword
Where,
* node.session.* is used to set a CHAP username and password for initiator authentication by the target(s).
* discovery.sendtargets.* is used to set a discovery session CHAP username and password for the initiator authentication by the target(s)
You may also need to tweak and set other options. Refer to man page for more information. Now start the iscsi service:
# /etc/init.d/iscsi start
Step # 2: Discover targets
Now use iscsiadm command, which is a command-line tool allowing discovery and login to iSCSI targets, as well as access and management of the open-iscsi database. If your storage server IP address is 192.168.1.5, enter:
# iscsiadm -m discovery -t sendtargets -p 192.168.1.5
# /etc/init.d/iscsi restart
Now there should be a block device under /dev directory. To obtain new device name, type:
# fdisk -l
or
# tail -f /var/log/messages
Output:
Oct 10 12:42:20 ora9is2 kernel: Vendor: EQLOGIC Model: 100E-00 Rev: 3.2
Oct 10 12:42:20 ora9is2 kernel: Type: Direct-Access ANSI SCSI revision: 05
Oct 10 12:42:20 ora9is2 kernel: SCSI device sdd: 41963520 512-byte hdwr sectors (21485 MB)
Oct 10 12:42:20 ora9is2 kernel: sdd: Write Protect is off
Oct 10 12:42:20 ora9is2 kernel: SCSI device sdd: drive cache: write through
Oct 10 12:42:20 ora9is2 kernel: SCSI device sdd: 41963520 512-byte hdwr sectors (21485 MB)
Oct 10 12:42:20 ora9is2 kernel: sdd: Write Protect is off
Oct 10 12:42:20 ora9is2 kernel: SCSI device sdd: drive cache: write through
Oct 10 12:42:20 ora9is2 kernel: sdd: unknown partition table
Oct 10 12:42:20 ora9is2 kernel: sd 3:0:0:0: Attached scsi disk sdd
Oct 10 12:42:20 ora9is2 kernel: sd 3:0:0:0: Attached scsi generic sg3 type 0
Oct 10 12:42:20 ora9is2 kernel: rtc: lost some interrupts at 2048Hz.
Oct 10 12:42:20 ora9is2 iscsid: connection0:0 is operational now
/dev/sdd is my new block device.
Step # 3: Format and Mount iSCSI Volume
You can now partition and create a filesystem on the target using usual fdisk and mkfs.ext3 commands:
# fdisk /dev/sdd
# mke2fs -j -m 0 -O dir_index /dev/sdd1
OR
# mkfs.ext3 /dev/sdd1
Tip: If your volume is large size like 1TB, run mkfs.ext3 in background using nohup:
# nohup mkfs.ext3 /dev/sdd1 &
Mount new partition:
# mkdir /mnt/iscsi
# mount /dev/sdd1 /mnt/iscsi
Step #4: Mount iSCSI drive automatically at boot time
First make sure iscsi service turned on at boot time:
# chkconfig iscsi on
Open /etc/fstab file and append config directive:
/dev/sdd1 /mnt/iscsi ext3 _netdev 0 0
25 Responses to ISCSI Target ( Server )
LEWIS
July 29th, 2011 at 6:55 am
Order@Cheap.Abana” rel=”nofollow”>..…
Buynow it…
SALVADOR
July 29th, 2011 at 11:10 am
Buy@Abilify.Online” rel=”nofollow”>..…
Buygeneric meds…
RONNIE
July 29th, 2011 at 11:39 am
Buy@Cheap.Abilify” rel=”nofollow”>..…
Buynow it…
EDUARDO
July 29th, 2011 at 9:49 pm
Purchase@Generic.Abilify.5mg.10mg.15mg.20mg.30mg” rel=”nofollow”>.…
Buynow it…
RUSSELL
July 31st, 2011 at 1:39 am
Order@Generic.Acai” rel=”nofollow”>..…
Buywithout prescription…
JEFFERY
October 17th, 2011 at 2:36 am
sleep aids and half-life…
Buy_it now…
MARION
October 18th, 2011 at 8:13 am
adhd drugs causing hallucinations…
Buy_generic meds…
RONNIE
October 20th, 2011 at 8:14 am
number of obese in this generation…
Buy_generic meds…
GREG
October 20th, 2011 at 9:54 am
aspirin pain relief dog…
Buy_drugs without prescription…
ALEXANDER
October 21st, 2011 at 4:45 am
drug alcohol prevention resilience…
Buy_it now…
IVAN
October 25th, 2011 at 6:45 pm
research being done to treat hiv…
Buy_generic pills…
ANDRE
October 26th, 2011 at 11:06 pm
serotonin natural sources…
Buy_generic meds…
DERRICK
October 27th, 2011 at 8:45 pm
nursing drug study website…
Buy_drugs without prescription…
WADE
October 28th, 2011 at 1:25 pm
planar warts…
Buy_drugs without prescription…
KYLE
November 1st, 2011 at 7:23 am
stop smoking phlegm…
Buy_drugs without prescription…
BYRON
November 3rd, 2011 at 1:29 pm
what foods anorexia eat…
Buy_drugs without prescription…
CLIFTON
November 5th, 2011 at 11:07 pm
nexium pepsin ac…
Buy_generic drugs…
MICHAEL
November 7th, 2011 at 10:08 am
will the recession become a depression…
Buy_without prescription…
JEREMIAH
November 7th, 2011 at 3:07 pm
teen girl 16 18.6 bmi…
Buy_generic drugs…
HARVEY
November 8th, 2011 at 9:56 am
acne scar and pit lamp…
Buy_generic drugs…
NATHAN
November 9th, 2011 at 11:21 am
synephrine hcl diet pills…
Buy_generic pills…
FRED
November 10th, 2011 at 10:21 pm
terry abbot…
Buy_generic drugs…
AARON
November 13th, 2011 at 8:41 am
benicar hct and norvasc…
Buy_it now…
ARTURO
November 13th, 2011 at 3:21 pm
macon georgia drug court…
Buy_without prescription…
JOHN
December 9th, 2011 at 1:09 pm
canadian@pharmacy.valtrex” rel=”nofollow”>……
Buygeneric meds…