-=Wok=- Blog


Your Network. Our Passion (Networking ed altro)
Anno 2008

Anno 2007

Anno 2006

iSCSI target HowTo on Enterprise Linux (RHEL4)

Su Digiwiki ho trovato questo how to che spiega in pochi

passaggi come far diventare un iSCSI target una macchina RedHat 4.

Chiaramente la cosa funziona anche su CentOS.





iSCSI target HowTo on Enterprise Linux (RHEL4)














Table of contents



1 Notice

2 About

3 Install the Target

4 Configure the Target

5 Configure the Linux Client

6 Resources

7 Corrections and Better Ways










About



This is a brief guide to setup an iSCSI Target and Initiator on RHEL4 using the iSCSI Enterprise Target (IET) (http://iscsitarget.sourceforge.net) software for Linux and the stock RHEL4 Initiator. The motivation for this was to provide a iSCSI target for Red Hat Inc's, GFS (http://www.redhat.com/en_us/USA/home/solutions/gfs/) (manual (http://www.redhat.com/docs/manuals/csgfs/browse/rh-gfs-en/)). Make sure you check out the iscsi-target website and for more infromation on iSCSI in general look at this guide (http://www.cuddletech.com/articles/iscsi/index.html) from Ben Rockwood .



Install the Target



1. Install RHEL4, I used kickstart with just "@ base" for packages. Configure the system with two drives sda and sdb or create two logical volumes(lvm). The first disk is for the OS and the second for the iSCSI storage. Run up2date and install the latest kernel.

up2date kernel


2 Reboot the box to use the updated kernel and then install the kernel source files, the openssl development packages, the gcc compiler and rpm-build needed to build the iscsi target source .

up2date kernel-devel openssl-devel gcc rpm-build


3. Download the rpm source package from http://www.cryptoforge.net/iscsi/RPMS, maintained by Bastiaan Bakker. As of this writing use version 0.4.12 as 0.4.13 will fail with the updated kernel (2.6.9-22.0.2.EL when I did this). I used /usr/src/iscsitarget to download the rpm as this is a OS resource, you can put it were ever you want. A quick note, Unless your a developer don't be tempted to complie from pure source, rpm stops you from having to chase down files from a "make && make install". The Redhat Package Manager is just that, a package manager, use it :-).

a. As root, make the directory for the package.

mkdir /usr/src/iscsitarget


b. Change into the newly created directory.

cd /usr/src/iscsitarget


c. Download the iscsitarget source from cryptoforge.

wget http://www.cryptoforge.net/iscsi/RPMS/iscsitarget-0.4.12-6.src.rpm


or you can grab the src.rpm directly from here

wget http://www.digicola.com/developer/iscsitarget-0.4.12-6.src.rpm


d. create the rpms from the rpm.src file.

rpmbuild --rebuild iscsitarget-0.4.12-6.src.rpm


e. This will build the iscsitarget and iscsi-kernel rpms, install the rpms with the normal commands.

rpm -Uvh /usr/src/redhat/RPMS/i386/iscsitarget-0.4.12-6.i386.rpm /usr/src/redhat/RPMS/i386/iscsitarget-kernel-0.4.12-6_2.6.9_22.0.2.EL.i386.rpm


f. Add iscsi-target to chkconfig and enable it.

chkconfig --add iscsi-target
chkconfig --level 2345 iscsi-target on


or

chkconfig iscsi-target on




Configure the Target



1. The configuration file for the iscsi-target is ietd.conf located in /etc. The following is the ietd.conf file that I am using to share sdb as an iscsi disk.

# iscsi target configuration 
 
Target iqn.2000-12.com.digicola:storage.lun1
        IncomingUser gfs secretsecret
        OutgoingUser
        Lun 0 Path=/dev/sdb,Type=fileio
        Alias iDISK0
        #MaxConnections  6


The iedt.conf file that I use is straight forward enough.



  1. The IncomingUser and OutgoingUser at the begining of the file defines users allowed to query the iscsi session (If empty then everyone is allowed). Note: The iscsi spec states that the password is 12 characters, (from what I have read) the MS initiator requires it.

  2. Targets definitions start with "Target" and the target name. The target name must be a globally unique name, the iSCSI standard defines the "iSCSI Qualified Name" as follows: iqn.yyyy-mm.[:identifier] "yyyy-mm" is the date at which the domain is valid and the identifier is freely selectable.

  3. The target can also require authentication, this time I used the user gfs with the password of secretsecret for the incoming user (iscsi initiator).

  4. The Type "fileio" is the default and can be used for disk, file or LVM.

  5. MaxConnections, This is no longer required as it is an outdated option.


2. Start the iscsi-target deamon and check /var/log/messages for success.

service iscsi-target restart




Configure the Linux Client



1. Install the iscsi-initiator-utils with up2date

up2date iscsi-initiator-utils


2. This installs the iscsi initiator on to the linux client along with a man page and rc start scripts. The iscsi initiator is configured with the iscsi.conf file located in /etc. Below is the iscsi.conf file used for the target above.

# simple iscsi.conf
 
DiscoveryAddress=172.30.0.28
            OutgoingUserName=gfs
            OutgoingPassword=secretsecret
       LoginTimeout=15
       DiscoveryAddress=172.30.0.28


3. Start the iscsi initiator and cross your fingers

service iscsi start


4. Check that the disk is visiable under proc, if it's not look in /var/log/messages on both the client and the host system.

cat /proc/scsi/scsi


Below is the output from my /proc/scsi/scsi

[root@gfs1 init.d]# cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: VMware,  Model: VMware Virtual S Rev: 1.0
  Type:   Direct-Access                    ANSI SCSI revision: 02
Host: scsi1 Channel: 00 Id: 00 Lun: 00
  Vendor: IET      Model: VIRTUAL-DISK     Rev: 0
  Type:   Direct-Access                    ANSI SCSI revision: 04


5. Next run the iscsi-ls command

iscsi-ls


Here is the output from this example

*******************************************************************************
SFNet iSCSI Driver Version ...4:0.1.11(12-Jan-2005)
*******************************************************************************
TARGET NAME             : iqn.2000-12.com.digicola:storage.lun1
TARGET ALIAS            :
HOST ID                 : 1
BUS ID                  : 0
TARGET ID               : 0
TARGET ADDRESS          : 172.30.0.28:3260,1
SESSION STATUS          : ESTABLISHED AT Thu Feb  9 01:22:37 EST 2006
SESSION ID              : ISID 00023d000001 TSIH 100
*******************************************************************************


6. Voila! you should now have a new SCSI disc avaiable for use. Now you can use fdisk to partition the disk (fdisk /dev/sdb) and use mkfs to format the partition (which is out of the scope of this howto).

7. Finally set the iscsi service start automatically

chkconfig iscsi on
Categoria: Linux
giovedì, 12 ott 2006 Ore. 14.17



  • Views Home Page: 87.937
  • Views Posts: 213.441
  • Views Gallerie: 14.267
  • n° Posts: 115
  • n° Commenti: 110
Copyright © 2002-2007 - Blogs 2.0
dotNetHell.it | Home Page Blogs
ASP.NET 2.0 Windows 2003