How to Install ISCSI_CLIENT (INITIATOR) on CentOS 6

To Install ISCSI_CLIENT (INITIATOR) on CentOS  6

iSCSI Initiator are the clients which use to authenticated with iSCSI target servers to access the LUNs shared from target server. We can deploy any kind of Operating systems in those locally mounted Disks, just a single package need to be install to get authenticate with target server  give the link of ISCSI-SERVER(TARGET). It is so simple to install  ISCSI_CLIENT (INITIATOR) on CentOS  6  and this article covers the ground on the same method. 

 

Installing Initiator

In order to start the process, you need to run the command to install the initiator. 

[root@linuxhelp1 Desktop]# yum install iscsi-initiator-utils.x86_64 -y
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Determining fastest mirrors
 * base: mirror.vbctv.in
 * extras: mirror.vbctv.in
 * updates: mirror.vbctv.in
base                                                     | 3.7 kB     00:00     
extras                                                   | 3.4 kB     00:00     
updates                                                  | 3.4 kB     00:00     
updates/primary_db                                       | 5.3 MB     00:00     
Resolving Dependencies
-->  Running transaction check
--->  Package iscsi-initiator-utils.x86_64 0:6.2.0.873-27.el6_9 will be installed
-->  Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                   Arch       Version                 Repository   Size
================================================================================
Installing:
 iscsi-initiator-utils     x86_64     6.2.0.873-27.el6_9      updates     732 k

Transaction Summary
================================================================================
Install       1 Package(s)

Total download size: 732 k
Installed size: 2.5 M
Downloading Packages:
iscsi-initiator-utils-6.2.0.873-27.el6_9.x86_64.rpm      | 732 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : iscsi-initiator-utils-6.2.0.873-27.el6_9.x86_64              1/1 
  Verifying  : iscsi-initiator-utils-6.2.0.873-27.el6_9.x86_64              1/1 

Installed:
  iscsi-initiator-utils.x86_64 0:6.2.0.873-27.el6_9                             

Complete!

 

And then, you should discover target  as follows. 

[root@linuxhelp1 Desktop]#  iscsiadm --mode discoverydb --type sendtargets --portal 192.168.7.240 &ndash discover
192.168.7.240:3260,1 iqn.20155555-11.com.linuxhelp:tgt1

 

To log-in use the below command to attach the LUN to our local System, this will authenticate with target server and allow us to log-in into LUN.

[root@linuxhelp1 Desktop]#  iscsiadm --mode node --targetname  iqn.20155555-11.com.linuxhelp:tgt1 --portal 192.168.7.240:3260 --login
Logging in to [iface: default, target: iqn.20155555-11.com.linuxhelp:tgt1, portal: 192.168.7.240,3260] (multiple)
Login to [iface: default, target: iqn.20155555-11.com.linuxhelp:tgt1, portal: 192.168.7.240,3260] successful.

 login to the LUN, list the records of Node
[root@linuxhelp1 Desktop]#  iscsiadm --mode node
192.168.7.240:3260,1 iqn.20155555-11.com.linuxhelp:tgt1

 

Later, you should list block 

[root@linuxhelp1 Desktop]# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0     11:0    1 1024M  0 rom  
sda      8:0    0   50G  0 disk 
├─sda1   8:1    0 29.3G  0 part /
├─sda2   8:2    0    2G  0 part [SWAP]
├─sda3   8:3    0    1K  0 part 
├─sda5   8:5    0    5G  0 part 
└─sda6   8:6    0   10G  0 part 
sdb      8:16   0  1.5G  0 disk

in above , output we can get new disk (sdb) which is the disk from target machine

 

 

Now create a new partition from new disk (sdb). 

[root@linuxhelp1 Desktop]#  fdisk -cu /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x2ce40f21.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won' t be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First sector (2048-3145727, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-3145727, default 3145727): 
Using default value 3145727

Command (m for help): 
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 83

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

 

After creating the new partition, assign file system for that partition as follows. 

[root@linuxhelp1 Desktop]#  mkfs.ext4 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
98304 inodes, 392960 blocks
19648 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=402653184
12 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912

Writing inode tables: done                            
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

For mounting , create a new directory  
[root@linuxhelp1 Desktop]# mkdir /mnt/iscsi

 

Later, give entry fstab by making use of the following command. 

[root@linuxhelp1 Desktop]# vim /etc/fstab 

 

And then, set the Mount point by using the mount command with the av option in the following manner. 

[root@linuxhelp1 Desktop]# mount -av
mount: tmpfs already mounted on /dev/shm
mount: devpts already mounted on /dev/pts
mount: sysfs already mounted on /sys
mount: proc already mounted on /proc
/dev/sdb1 on /mnt/iscsi type ext4 (rw,_netdev)

 

After that, you need to check block list

NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0     11:0    1 1024M  0 rom  
sda      8:0    0   50G  0 disk 
├─sda1   8:1    0 29.3G  0 part /
├─sda2   8:2    0    2G  0 part [SWAP]
├─sda3   8:3    0    1K  0 part 
├─sda5   8:5    0    5G  0 part 
└─sda6   8:6    0   10G  0 part 
sdb      8:16   0  1.5G  0 disk 
└─sdb1   8:17   0  1.5G  0 part /mnt/iscsi

New partition is created and mounted , we can use iscsi storage in mounted directory. With this, the installation of  ISCSI_CLIENT (INITIATOR) on CentOS 6 comes to an end. 


     
 

FAQ
Q
Do regular Ethernet switches work with iSCSI?
A
Yes. From the network perspective, iSCSI traffic just looks like another IP packet. All existing Ethernet switches and IP routers work transparently.
Q
Can I expand the disk capacity of my NAS if it is almost full?
A
Yes, you may increase the physical disk capacity by “Online RAID Capacity Expansion”
Q
Can I expand the LUN size if it is almost full?
A
Yes, since firmware 3.X.X in x86-based and firmware 3.X.X in ARM-based.
Q
What is the maximum size for each LUN?
A
If you create an iSCSI LUN with Thin-Provisioning, the maximum size can be 32768GB. If you use Instant Allocation, the maximum size is equal to remain capacity of the selected disk volume.
Q
Do QNAP NAS products support LUN masking or ACL?
A
Yes, QNAP Turbo NAS all support LUN masking (since firmware 3.2.0 in x86-based and firmware 3.3.0 in ARM-based). You can set up LUN masking or ACL by each initiator. In other words, each init