Configure iSCSI Initiator on Ubuntu 15.10 Server – PART 3

Configure iSCSI Initiator on Ubuntu 15.10 Server

In this short article we will see how to configure iSCSI Initiator on Ubuntu 15.10 Server from iSCSI target Server. As previous we have seen how to Configure iSCSI Target and Initiator on  Centos 7 / Window 10,  refer below link.

How to Build your Own Secure Storage Using iSCSI SAN Storage – Part 1  

Configure iSCSI Initiator on Window 10 System

1) Install the Initiator Package.

To Configure a client machine(Ubuntu) to use this target as a storage, install below package on the client machine (webserver).

gaurav@webserver:~$ sudo apt install open-iscsi -y

2) Edit the initiatorname.iscsi conf. file.

Edit below file and add iscsi initiator name.

gaurav@webserver:~$ sudo nano /etc/iscsi/initiatorname.iscsi

#sudo nano /etc/iscsi/initiatorname.iscsi

## If you remove this file, the iSCSI daemon will not start.
## If you change the InitiatorName, existing access control lists
## may reject this initiator.  The InitiatorName must be unique
## for each iSCSI initiator.  Do NOT duplicate iSCSI InitiatorNames.

Restart the initiator service.

gaurav@webserver:~$ sudo /etc/init.d/open-iscsi restart
[ ok ] Restarting open-iscsi (via systemctl): open-iscsi.service.

3) Edit /etc/iscsi/iscsid.conf file.

Once the open-iscsi package is installed, edit /etc/iscsi/iscsid.conf changing the following;

gaurav@webserver:~$ sudo nano /etc/iscsi/iscsid.conf

#sudo nano /etc/iscsi/iscsid.conf

# To request that the iscsi initd scripts startup a session set to "automatic".
node.startup = automatic

You can check which targets are available by using the iscsiadm utility.

gaurav@webserver:~$ sudo iscsiadm -m discovery -t st -p,1

Where,“-m” determines the mode that iscsiadm executes in.“-t” specifies the type of discovery.“-p” option indicates the target IP address.

4) Log into the configuration target from the iSCSI target server.

Log into the presented iSCSI target, using below command.

gaurav@webserver:~$ sudo iscsiadm -m node --login
Logging in to [iface: default, target:, portal:,3260] (multiple)
Login to [iface: default, target:, portal:,3260] successful.

Identify the newly available block device created by the iSCSI target login.

gaurav@webserver:~$ lsblk
sda                        8:0    0    8G  0 disk
+-sda1                     8:1    0  243M  0 part /boot
+-sda2                     8:2    0    1K  0 part
+-sda5                     8:5    0  7.8G  0 part
  +-webserver--vg-root   252:0    0  6.7G  0 lvm  /
  +-webserver--vg-swap_1 252:1    0 1020M  0 lvm  [SWAP]
sdb                        8:16   0    4G  0 disk
+-sdb1                     8:17   0   32M  0 part
+-sdb2                     8:18   0    4G  0 part
sdc                        8:32   0    4G  0 disk
+-sdc1                     8:33   0    4G  0 part
sdd                        8:48   0    4G  0 disk
sr0                       11:0    1 1024M  0 rom

5) Prepare the Physical device.

Use fdisk to create a new partition for use with LVM.

gaurav@webserver:~$ sudo fdisk /dev/sdd
Welcome to fdisk (util-linux 2.26.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (8192-8388607, default 8192): 8192
Last sector, +sectors or +size{K,M,G,T,P} (8192-8388607, default 8388607): 8388607

Created a new partition 1 of type 'Linux' and of size 4 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
Format the new disk.

gaurav@webserver:~$ sudo partprobe /dev/sdd

Format the new disk.

gaurav@webserver:~$ sudo mkfs.ext4 /dev/sdd1
mke2fs 1.42.12 (29-Aug-2014)
Creating filesystem with 1047552 4k blocks and 262144 inodes
Filesystem UUID: 6e210820-128e-4c28-abb6-f9c44d25553b
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736

Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done


Use “mkdir” command to create the directory and mount the disk on temporarily basis.

gaurav@webserver:~$ sudo mkdir /mnt/webdoc
gaurav@webserver:~$ sudo mount /dev/sdd1 /mnt/webdoc/
gaurav@webserver:~$ df -h /mnt/webdoc/
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdd1       3.9G  8.0M  3.7G   1% /mnt/webdoc

To Permanently we add an entry on fstab file.

gaurav@webserver:~$ sudo blkid /dev/sdd1
/dev/sdd1: UUID="6e210820-128e-4c28-abb6-f9c44d25553b" TYPE="ext4" PARTUUID="f56bfd98-01"

#sudo nano /etc/fstab

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/webserver--vg-root /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sda1 during installation
UUID=0dca0efa-d21b-45e3-86fa-37fe1bd91db0 /boot           ext2    defaults        0       2
/dev/mapper/webserver--vg-swap_1 none            swap    sw              0       0
UUID="6e210820-128e-4c28-abb6-f9c44d25553b"     /mnt/webdoc/    ext4    defaults       0  0

6) Logout the configuration target from the iSCSI target server.

gaurav@webserver:~$ sudo iscsiadm -m node --logout
Logging out of session [sid: 1, target:, portal:,3260]
Logout of [sid: 1, target:, portal:,3260] successful.

Hope this post will help Linux/Unix beginners. Please share you feedback and Comments and Stay tune for more updates with ..!!!

Leave a Reply


This site uses Akismet to reduce spam. Learn how your comment data is processed.

Notify of