{"id":56,"date":"2008-02-18T14:51:58","date_gmt":"2008-02-18T12:51:58","guid":{"rendered":"http:\/\/lexa.tenet.ua\/blog\/2008\/02\/18\/iscsi\/"},"modified":"2014-11-25T02:38:47","modified_gmt":"2014-11-25T00:38:47","slug":"iscsi","status":"publish","type":"post","link":"https:\/\/lexa.od.ua\/blog\/2008\/02\/18\/iscsi\/","title":{"rendered":"CentOS \/ Red Hat Linux: Install and manage iSCSI Volume"},"content":{"rendered":"<p>Internet SCSI (iSCSI) is a network protocol s that allows you to use of the SCSI protocol over TCP\/IP networks. It is good alternative to Fibre Channel-based SANs. You can easily manage, mount and format iSCSI Volume under Linux. It allows access to SAN storage over Ethernet.<\/p>\n<h2>Open-iSCSI Project<\/h2>\n<p><a href=\"http:\/\/www.open-iscsi.org\/\" target=\"_blank\">Open-iSCSI<\/a> project is a high-performance, transport independent, multi-platform implementation of iSCSI. Open-iSCSI is partitioned into user and kernel parts.<!--more--><\/p>\n<p>Instructions are tested on:<br \/>\n[a] RHEL 5<br \/>\n[b] CentOS 5<br \/>\n Fedora 7<br \/>\n[d] Debian \/ Ubuntu Linux<\/p>\n<h2>Install Required Package<\/h2>\n<p><strong>iscsi-initiator-utils RPM package<\/strong> &#8211; 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:<br \/>\n<code># yum install iscsi-initiator-utils<\/code><\/p>\n<h3>A note about Debian \/ Ubuntu Linux<\/h3>\n<p>If you are using <strong>Debian \/ Ubuntu<\/strong> Linux install open-iscsi package, enter:<br \/>\n<code>$ sudo apt-get install open-iscsi<\/code><\/p>\n<h2>iSCSI Configuration<\/h2>\n<p>There are three steps needed to set up a system to use iSCSI storage:<\/p>\n<ol>\n<li>iSCSI startup using the init script or manual startup. You need to edit and configure iSCSI via \/etc\/iscsi\/iscsid.conf file<\/li>\n<li>Discover targets.<\/li>\n<li>Automate target logins for future system reboots.<\/li>\n<li>You also need to obtain iSCSI username, password and storage server IP address (target host)<\/li>\n<\/ol>\n<h3>Step # 1: Configure iSCSI<\/h3>\n<p>Open \/etc\/iscsi\/iscsid.conf with vi text editor:<br \/>\n<code># vi \/etc\/iscsi\/iscsid.conf<\/code><br \/>\nSetup username and password:<br \/>\n<code>node.session.auth.username = My_ISCSI_USR_NAME<br \/>\nnode.session.auth.password = MyPassword<br \/>\ndiscovery.sendtargets.auth.username = My_ISCSI_USR_NAME<br \/>\ndiscovery.sendtargets.auth.password = MyPassword<\/code><\/p>\n<p>Where,<\/p>\n<ul>\n<li><strong>node.session.* <\/strong>is used to set a CHAP username and password for initiator authentication by the target(s).<\/li>\n<li><strong>discovery.sendtargets.*<\/strong> is used to set a discovery session CHAP username and password for the initiator authentication by the target(s)<\/li>\n<\/ul>\n<p>You may also need to tweak and set other options. Refer to man page for more information. Now start the iscsi service:<br \/>\n<code># \/etc\/init.d\/iscsi start<\/code><\/p>\n<h3>Step # 2: Discover targets<\/h3>\n<p>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:<br \/>\n<code># iscsiadm -m discovery -t sendtargets -p 192.168.1.5<br \/>\n# \/etc\/init.d\/iscsi restart<\/code><\/p>\n<p>Now there should be a block device under \/dev directory. To obtain new device name, type:<br \/>\n<code># fdisk -l<\/code><br \/>\nor<br \/>\n<code># tail -f \/var\/log\/messages<\/code><br \/>\nOutput:<\/p>\n<pre>Oct 10 12:42:20 ora9is2 kernel:   Vendor: EQLOGIC   Model: 100E-00           Rev: 3.2\r\nOct 10 12:42:20 ora9is2 kernel:   Type:   Direct-Access                      ANSI SCSI revision: 05\r\nOct 10 12:42:20 ora9is2 kernel: SCSI device sdd: 41963520 512-byte hdwr sectors (21485 MB)\r\nOct 10 12:42:20 ora9is2 kernel: sdd: Write Protect is off\r\nOct 10 12:42:20 ora9is2 kernel: SCSI device sdd: drive cache: write through\r\nOct 10 12:42:20 ora9is2 kernel: SCSI device sdd: 41963520 512-byte hdwr sectors (21485 MB)\r\nOct 10 12:42:20 ora9is2 kernel: sdd: Write Protect is off\r\nOct 10 12:42:20 ora9is2 kernel: SCSI device sdd: drive cache: write through\r\nOct 10 12:42:20 ora9is2 kernel:  sdd: unknown partition table\r\nOct 10 12:42:20 ora9is2 kernel: sd 3:0:0:0: Attached scsi disk sdd\r\nOct 10 12:42:20 ora9is2 kernel: sd 3:0:0:0: Attached scsi generic sg3 type 0\r\nOct 10 12:42:20 ora9is2 kernel: rtc: lost some interrupts at 2048Hz.\r\nOct 10 12:42:20 ora9is2 iscsid: connection0:0 is operational now<\/pre>\n<p><strong>\/dev\/sdd<\/strong> is my new block device.<\/p>\n<h3>Step # 3: Format and Mount iSCSI Volume<\/h3>\n<p>You can now partition and create a filesystem on the target using usual fdisk and mkfs.ext3 commands:<br \/>\n<code># fdisk \/dev\/sdd<br \/>\n# mke2fs -j -m 0 -O dir_index \/dev\/sdd1<\/code><br \/>\nOR<br \/>\n<code># mkfs.ext3 \/dev\/sdd1<\/code><\/p>\n<p>Tip: If your volume is large size like 1TB, run mkfs.ext3 in background using nohup:<br \/>\n<code># nohup mkfs.ext3 \/dev\/sdd1 &amp;<\/code><\/p>\n<p>Mount new partition:<br \/>\n<code># mkdir \/mnt\/iscsi<br \/>\n# mount \/dev\/sdd1 \/mnt\/iscsi<\/code><\/p>\n<h3>Step #4: Mount iSCSI drive automatically at boot time<\/h3>\n<p>First make sure iscsi service turned on at boot time:<br \/>\n<code># chkconfig iscsi on<\/code><br \/>\nOpen \/etc\/fstab file and append config directive:<br \/>\n<code>\/dev\/sdd1 \/mnt\/iscsi ext3 _netdev 0 0<\/code><br \/>\nSave and close the file.<\/p>\n<h2>Further readings:<\/h2>\n<ul>\n<li><a href=\"http:\/\/www.open-iscsi.org\/index.html#docs\" target=\"_blank\">Official Open iSCSI<\/a> documentation<\/li>\n<li>Read iscsiadm and related man pages<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Internet SCSI (iSCSI) is a network protocol s that allows you to use of the SCSI protocol over TCP\/IP networks. It is good alternative to Fibre Channel-based SANs. You can easily manage, mount and format iSCSI Volume under Linux. It allows access to SAN storage over Ethernet. Open-iSCSI Project Open-iSCSI project is a high-performance, transport [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[2],"tags":[7],"class_list":["post-56","post","type-post","status-publish","format-standard","hentry","category-unix","tag-iscsi-linux-centos"],"_links":{"self":[{"href":"https:\/\/lexa.od.ua\/blog\/wp-json\/wp\/v2\/posts\/56","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lexa.od.ua\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lexa.od.ua\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lexa.od.ua\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/lexa.od.ua\/blog\/wp-json\/wp\/v2\/comments?post=56"}],"version-history":[{"count":2,"href":"https:\/\/lexa.od.ua\/blog\/wp-json\/wp\/v2\/posts\/56\/revisions"}],"predecessor-version":[{"id":1256,"href":"https:\/\/lexa.od.ua\/blog\/wp-json\/wp\/v2\/posts\/56\/revisions\/1256"}],"wp:attachment":[{"href":"https:\/\/lexa.od.ua\/blog\/wp-json\/wp\/v2\/media?parent=56"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lexa.od.ua\/blog\/wp-json\/wp\/v2\/categories?post=56"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lexa.od.ua\/blog\/wp-json\/wp\/v2\/tags?post=56"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}