Connecting to your Block Storage Volume using ISCSI

Step 1: Install iSCSI Drivers and Utilities

Linux: Install the Open-iSCSI package using your distribution's package management system.

The Open-iSCSI project is a high performance, transport independent, multi-platform implementation of RFC3720 (The iSCSI specification). It consists of a minimal set of kernel modules combined with powerful userspace utilities. Once installed on a system, a daemon process iscsid can be controlled using the iscsiadm management utility. Open-iSCSI requires a Linux kernel of 2.6.16 or greater.


CentOS 5/6: Open-iSCSI can be installed using yum:

  $ sudo yum install iscsi-initiator-utils

Debian/Ubuntu: Open-iSCSI can be installed using apt:

  $ sudo apt-get install open-iscsi

Arch Linux: Open-iSCSI can be installed from source using the Arch User Repository (AUR):

  $ sudo pacman -Syu
  $ sudo pacman -S --needed base-devel 
  $ sudo pacman -S parted
  # reboot your vm
  # for some reason is not resolving on our default nameservers
  $ wget
  $ tar -xzvf open-iscsi.tar.gz
  $ cd open-iscsi
  # if doesn't resolve, add to /etc/hosts file
  $ makepkg -s
  $ sudo pacman -U open-iscsi-2.0.873-5-x86_64.pkg.tar.xz

Windows: iscsi tools are already installed on Windows 2008 and 2012 Server Editions

Step 2: Configure iSCSI Drivers and Utilities


Open /etc/iscsi/iscsid.conf with the text editor of your choice:

    $ sudo vi /etc/iscsi/iscsid.conf

Make the following edits to the configuration file. Set the values of username and password to the CHAP username/password provided to you when you purchased the block storage.

    node.startup = automatic
    node.session.auth.authmethod = CHAP
    node.session.auth.username = <your CHAP username>
    node.session.auth.password = <your CHAP password>
    discovery.sendtargets.auth.authmethod = CHAP
    discovery.sendtargets.auth.username = <chap username>
    discovery.sendtargets.auth.password = <chap password>

Next, you must start the iscsi service, and run the discovery command against the discovery IP provided in your block storage welcome email. After the discovery command is run, you must restart the iscsi service.


CentOS 5/6:

  $ sudo service iscsi start
  $ sudo iscsiadm -m discovery -t sendtargets -p <Discovery IP Address>
  $ sudo service iscsi restart


  $ sudo service open-iscsi start
  $ sudo iscsiadm -m discovery -t sendtargets -p <Discovery IP Address>
  $ sudo service open-iscsi restart

Arch Linux:

  $ modprobe nfnetlink
  $ sudo systemctl enable open-iscsi.service
  $ sudo systemctl start open-iscsi.service
  $ sudo iscsiadm -m discovery -t sendtargets -p <Discovery IP Address>
  $ iscsiadm -m node -L all

Proceed to Setting up Storage Volumes in Linux below

Windows 2008 Server

Configuring iSCSI on Windows is done using the 'iSCSI Initiator'. You must be logged in as Administrator, or launch the program using the 'Run as Administrator' context menu.

The easiest way to launch the utility is to access it through the Control Panel using the following path:

    Start->Control Panel->System and Security->Administrative Tools->iSCSI Initiator 

You may be warned that the iSCSI service is not running - if so, click the button to start the service. After loading the utility, you should see something like the following:



Click on the 'Discovery' tab, then on the 'Discover Portal..' button. Enter in the discovery IP address sent to you in your block storage welcome email.


Next, click on the 'Advanced...' button, then on the 'Enable CHAP log on' checkbox. Enter in the CHAP Username and Password you received in your block storage welcome email in the text boxes labeled 'Name:' and 'Target Secret:', respectively.


Press the 'OK' button twice to return to the main iSCSI Initiator screen. You should see a discovered target in the 'inactive' state.


Click on the discovered target to highlight it, then click on 'Connect'. At the next dialogue, click on 'Advanced...'. Much like you did above with the Advanced Discovery tab, enter in your CHAP credentials and then press 'OK' twice.


To ensure that Windows connects to your block storage device automatically after every reboot, click on the 'Volumes and Devices' tab, and then click the 'Auto Configure' button. Your volume should then appear in the Volume List.



Proceed to Setting up Storage Volumes in Windows 2008 Server below

Windows 2012 Server

Configuring iSCSI on Windows Server 2012 is similar to Windows Server 2008, however, some of the paths/windows are slightly different. To launch the 'iSCSI Initiator' utility, log in as Administrator and navigate to the following path:

    Server Manager->Tools->iSCSI Initiator


You may be warned that the iSCSI service is not running - if so, click the button to start the service. After loading the utility, you should see something like the following:


From this point, you can proceed following the same steps as above for Windows Server 2008.

Step 3: Setup Storage Volumes


After successfully discovering your block storage disk, the volume should show as available to the fdisk command:

    # fdisk -l

        ....output truncated....

        Disk /dev/sda: 300.0 GB, 300000002048 bytes
        255 heads, 63 sectors/track, 36472 cylinders
        Units = cylinders of 16065 * 512 = 8225280 bytes
        Sector size (logical/physical): 512 bytes / 4096 bytes
        I/O size (minimum/optimal): 4096 bytes / 4096 bytes
        Disk identifier: 0x00000000

        Disk /dev/sda doesn't contain a valid partition table

At this point, you can create filesystems on the disk or configure it as a raw block device as desired:

    # parted /dev/sda
    GNU Parted 2.2
    Using /dev/sda
    Welcome to GNU Parted> ! Type 'help' to view a list of commands.
    (parted) mklabel gpt
    (parted) mkpart extended 0% 100%
    (parted) print
    Model: SolidFir SSD SAN (scsi)
    Disk /dev/sda: 300GB
    Sector size (logical/physical): 512B/4096B
    Partition Table: gpt

    Number  Start   End    Size   File system  Name      Flags
     1      1049kB  300GB  300GB               extended

     (parted) quit
    # mkfs -t ext3 -L myBlockStorage /dev/sda1
    mke2fs 1.41.11 (14-Mar-2010)
    Filesystem label=myBlockStorage
    .... output truncated ....
    # mkdir /mnt/my_block_storage_volume ; mount /dev/sda1 /mnt/my_block_storage_volume/
    # vim /etc/fstab # Edit your /etc/fstab to add an entry for the fs

NOTE: SAN disks can be slow to format due to the large number of small IOPs required by the formatting utility. To speed the formatting of your disk, you may wish to pass the '-E lazy_itable_init' option to mkfs.

In order to automatically connect to your block storage disk on system startup, make the following changes to the /etc/iscsi/nodes//default file:

    node.conn[0].startup = automatic

Windows 2008/2012 Server

Configuring your block storage device as a system volume is done using the 'Disk Management' utility. The easiest way to launch the utility is to access it through the Control Panel using the following path:

    Server 2008: Start->Control Panel->System and Security->Administrative Tools->Computer Management

    Server 2012: Server Manager->Tools->Computer Management

Click on the Storage->Disk Management icon to bring up the utility.


If this is the first time you've accessed your block storage disk, you will need to initialize it. GPT is usually the safest choice, unless you have special requirements such as an older version of Windows. After you've initialized the disk, you can then proceed to configure it as desired.


Here, we create a simple volume spanning the entire disk and have Windows format it as NTFS and mount it as the drive letter E:




After this is complete, you can use the volume as if it were a local disk in your system.

Posted in
Last update:
2015-12-03 20:39
Average rating:0 (0 Votes)