Upload
scolomaay
View
215
Download
0
Embed Size (px)
Citation preview
7/31/2019 iSCSI Server
1/3
Running an iSCSI SAN on CentOS 5July 14th, 2008 Remco Bressers Leave a comment Go to comments
Running iSCSI target on a Fedora system is as easy as yum install iscsitarget and configure thething. Unfortunatly, on CentOS, the iSCSI Enterprise Target (IET) daemon is not in the defaultYum repositories, because CentOS usually uses TGT ( Linux SCSI Target Framework ).Ok, i could dive into using TGT on a CentOS box, but thats not what i wanted to use on acorporate SAN. So, lets find it out the hard way and build from source.
The iSCSI Target system
First, some prerequisites :
# yum install kernel-devel openssl-devel gcc rpm-build
Download the latest IET from the Sourceforge repo and put the tgz in /usr/src
# cd /usr/src# tar xvf iscsitarget-0.4.15.tar.gz# cd iscsitarget-0.4.15# make# make install
Alright. IETD is installed and ready to use. The iscsi-target init.d script is installed and will bestarted at boot-time. Nice! One bad thing is, that every time you install a new kernel, you need torecompile ietd . Write this down on your forehead or somewhere you will look at every single day
Configuring ietd is a piece of cake if the documentation would be easy findable, but it isnt (orwasnt).First, lets decide who can connect to the IET daemon :
# vi /etc/initiators.allow
iqn.2008-07.my-sanhead:mydiskname 192.168.1.0/24
Yep, quite a strange string. Its called an IQN (iscsi qualified name) and i use this namingconvention:iqn.-.:The IQN is an identifier for your iSCSI target. A target can consist of multiple disks and/or luns.The iSCSI initiator uses the IQN to connect to these disks/luns. The subnet 192.168.1.0/24 isallowed to use this iSCSI target.
Next, well create the initiators.deny file, which is pretty straightforward :# vi /etc/initiators.deny
ALL:ALL
Time to create the IQN in the ietd configuration file.
# vi /etc/ietd.conf
Target iqn.2008-07.my-sanhead:mydisknameIncomingUser username 12345OutgoingUser username 123456789012Lun 0 Path=/dev/SAN/diskname,Type=fileio,IOMode=wbAlias iSCSI for disknameImmediateData Yes
http://remcobressers.nl/author/admin/http://remcobressers.nl/2008/07/running-iscsi-san-centos-5/#respondhttp://remcobressers.nl/2008/07/running-iscsi-san-centos-5/#commentshttp://remcobressers.nl/2008/07/running-iscsi-san-centos-5/#commentshttp://iscsitarget.sourceforge.net/http://iscsitarget.sourceforge.net/http://stgt.berlios.de/http://iscsitarget.sourceforge.net/http://iscsitarget.sourceforge.net/http://remcobressers.nl/2008/07/running-iscsi-san-centos-5/#respondhttp://remcobressers.nl/2008/07/running-iscsi-san-centos-5/#commentshttp://iscsitarget.sourceforge.net/http://stgt.berlios.de/http://iscsitarget.sourceforge.net/http://remcobressers.nl/author/admin/7/31/2019 iSCSI Server
2/3
7/31/2019 iSCSI Server
3/3
# iscsiadm -m discovery -t st -p 192.168.1.1192.168.1.1:3260,1 iqn.2008-7.my-sanhead:mydiskname
As you can see, it found the target we created before. Now, lets login to it:
# iscsiadm -m node -p 192.168.1.1 -T iqn.2008-7.my-sanhead:mydiskname --login