Posts Tagged ‘san’
SAN w/o the cost – CentOS + iScsi
Nowadays, the iSCSI technology is quite popular in the storage world
Running iSCSI target on a Fedora system is as easy as “yum install iscsitarget” and configure the thing.
On CentOS – however iSCSI Enterprise Target (IET) daemon is not in the default Yum repositories – and while CentOS does offer TGT (Linux SCSI Target Framework) I think for a SAN – IET is best.
In short – this requires us to start from scratch – and build from source. It is important to note – whenever you update your kernel – you will need to recompile.
The iSCSI Target system
First, some prerequisites :
# yum install openssl-devel kernel-dev 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.17.tar.gz # cd iscsitarget-0.4.17 # make # make install
Like most everything in linux – now that the make install is complete – your ready to go (except a minor configuration of course). The iscsi-target init.d script is installed and will be started at boot-time.
Configuring the ietd host is pretty simple and the WIKI has tons of valuable information.
First, lets decide who can connect to the IET daemon :
First you have to have a naming convention for your IQN (iScsi Qualified Name) - The IQN is an identifier for your iSCSI target.
Ok – so glenn – what the heck is this needed for? – I’m glad you asked.. The iSCSI initiator using the IQN to connect to the disks/lun’s.
# nano /etc/initiators.allow
iqn.namingconvension:mydiskname 10.0.100.0/24
In the above example The subnet 10.0.100.0/24 is allowed to use this iSCSI target.
Next, we’ll create the initiators.deny file, which is pretty straightforward :
# nano /etc/initiators.deny
ALL:ALL
Time to create the IQN in the ietd configuration file.
# nano /etc/ietd.conf
Targetiqn.namingconvension:mydiskname IncomingUser username 12345 OutgoingUser username 123456789012 Lun 0 Path=/dev/SAN/diskname,Type=fileio,IOMode=wb Alias iSCSI for diskname ImmediateData Yes MaxConnections 1 InitialR2T Yes
I use the following conventions, as defined in the RFC :
For IncomingUser: Password always 5 characters
For OutgoingUser: Password always 12 characters
I suggest using LVM as a disk backend. The disk can also be /dev/sdb or whatever your heart desires…
The iSCSI Initiator
In Ubuntu/Debian/Fedora/ (or pick your Nix version and place here) there usually is an open-iscsi in the repository. If not, you can always compile it from source at http://www.open-iscsi.org.
I love the CentOS Nix version – so the directions below – are assuming you have a CentOS system you would like to use with your new san.
Let’s install the prerequisites :
# yum install iscsi-initiator-utils # yum install open-iscsi
Next, define the initiator name. This is in the exact same form as the target name, but it should not be the same. This initiator name is the name (in IQN) of your computer.
# nano /etc/iscsi/initiatorname.iscsi InitiatorName=iqn.namingconvension:someuniquename
Next, we’re going to configure the authentication and some specials in the iscsid config.
# nano /etc/iscsi/iscsid.conf node.startup = automatic node.session.auth.authmethod = CHAP node.session.auth.username = username node.session.auth.password = 12345 node.session.auth.username_in = username node.session.auth.password_in = 123456789012 node.session.timeo.replacement_timeout = 120 node.conn[0].timeo.login_timeout = 15 node.conn[0].timeo.logout_timeout = 15 node.conn[0].timeo.noop_out_interval = 10 node.conn[0].timeo.noop_out_timeout = 15 node.session.initial_login_retry_max = 10 node.session.cmds_max = 128 node.session.queue_depth = 32 node.session.iscsi.InitialR2T = No node.session.iscsi.ImmediateData = Yes node.session.iscsi.FirstBurstLength = 262144 node.session.iscsi.MaxBurstLength = 16776192 node.conn[0].iscsi.MaxRecvDataSegmentLength = 131072 discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768 node.session.iscsi.FastAbort = No
For more information about these setting, please refer to the open-iscsi page.
Next up, start the thing :
# service iscsi start
Bingo! You just started the iSCSI daemon (all cheer).
Now, we’re going to discover our targets on the target iSCSI host. I assume 10.0.100.1 is the target host in this example.
# iscsiadm -m discovery -t st -p 10.0.100.1 10.0.100.1:3260,1 iqn.namingconvension:mydiskname
As you can see, it found the target we created before. Now, let’s login to it:
# iscsiadm -m node -p 10.0.100.1 -T iqn.namingconvension:mydiskname --login
Congratulations Chap – if you do dh -alh – or dmesg you will find a new disk inserted (/dev/sdc or whatever).
Pages
Tags
apple Archived asperger's autism blogging cat6 Chatter Church cisco citrt comcast convention cPanel datacenter debugging mysql devil evangelism facebook faith family iPad iPhone iscsi Leadership Linux MAC Marketing Microsoft MySQL network Off the wall crazy OpenSource or just weirdly different pfsense politics Ramblings review Security skype Sprint Storage Technology Web 2.0 minus or plus Wifi wisp

