There is a point to this story, but it has temporarily escaped my mind...
Contact Me MyFaceBook MyLinkedIn MyGitHub MyTwitter

Install and Manage iSCSI

Internet SCSI (iSCSI) is a network protocol 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 Volumes under Linux. It allows access to storage over Ethernet.

Open-iSCSI Project

The Open-iSCSI project is a high-performance, transport independent, multi-platform implementation of iSCSI. Open-iSCSI is partitioned into user and kernel parts. To use iSCSI on CentOS, you just need to install the iscsi-initiator-utils RPM package. This package provides the server daemon for the iSCSI protocol, as well as the utility programs used to manage it. The RPM package can be installed using yum command:

# yum install iscsi-initiator-utils

iSCSI Configuration

There are a few steps that are needed to set up a system to use iSCSI storage:

  1. iSCSI startup using the init script or manual startup.
  2. Discover targets.
  3. Automate target logins for future system reboots.
  4. You also may need to obtain iSCSI username, password
  5. You will need the storage server IP address (target host)

Configure iSCSI

If you need a user name and password to access the storage, open /etc/iscsi/iscsid.conf to configure user name and password:

node.session.auth.username = MY_ISCSI_USER_NAME
node.session.auth.password = MY_ISCSI_PASSWORD
discovery.sendtargets.auth.username = MY_ISCSI_USER_NAME
discovery.sendtargets.auth.password = MY_ISCSI_PASSWORD
  • 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.

Discover Targets

Use the iscsiadm command, which is the 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 start

Now there should be a block device under /dev directory. To obtain new device name, type:

# fdisk -l

On my system, '/dev/sda' was my new block device.

Format and Mount

If a partition and file system don't already exist on the target, they must be created using fdisk and mkfs.ext3 commands:

# fdisk /dev/sda
  (type n to create a new partition, p for primary, and then 1 for
    the partition number, the defaults for the remaining questions are fine...)
# mkfs.ext3 /dev/sda1

Mount new partition:

# mkdir /mnt/iscsi
# mount /dev/sda1 /mnt/iscsi

Mount iSCSI Automatically At Boot Time

Turn on the iSCSI service at boot time:

# chkconfig iscsi on

Open /etc/fstab file and append this directive:

/dev/sda1 /mnt/iscsi ext3 _netdev 0 0

Save and close the file.

For More Information

Copyright © 2019 by Julian Easterling. SOME RIGHTS RESERVED.
Privacy Policy              Terms of Use             


Creative Commons License
Except where otherwise noted, content on this site is
licensed under a Creative Common Attribution-Share Alike 4.0 International License.


All of the opinions expressed on this website are those of Julian Easterling and
do not represent the views of any of my current and previous clients or employers in any way.

If you notice an error on the site or content that has not been properly attributed, bring
it to my attention using the contact page and I will endeavor to fix it as soon as I can.

I accept no responsibility or liability for any damages incurred by following any of
my advice or by using any of the information on my site or of those sites that I link to.