Connect with us

Hi, what are you looking for?

Linux

How to Configure ISCSI Target Server on CentOS 8 / RHEL 8

In this tutorial we will configure ISCSI Target Server on CentOS 8 / RHEL 8. ISCSI stands for Internet Small Computer Systems Interface.  This protocol is used for storage networking which is very useful for the data storage linking facilities. In CentOS 8 / RHEL 8 there is a by default package is present named as targetcli that is useful to configure the ISCSI server.

Step-1 : Check whether the targetcli packages is install by default or not

In this command if anything shows in output means the packages are installed by default. If no output is present then we need to to install the packages using step 2 of this tutorial.

[root@techbrown ~]# rpm -q targetcli

Step-2 : Install the targetcli package using DNF package manager

[root@techbrown ~]# dnf install targetcli -y

Step-3 : As soon as installation completes start the services of targetcli

[root@techbrown ~]# systemctl start target

Step-4 : Enable the services of targetcli so that it will survive during boot

[root@techbrown ~]# systemctl enable target

It will show given output

ln -s '/usr/lib/systemd/system/target.service' '/etc/systemd/system/multi-user.target.wants/target.service'

Step-5 : Open the ISCSI port from the firewalld firewall for communicating with ISCSI

[root@techbrown ~]# firewall-cmd --permanent –add-port=3260/tcp

It will show given output

Advertisement. Scroll to continue reading.
success

Step-6 : When done reload the firewall to activate the new rules

[root@techbrown ~]# firewall-cmd –reload

It will show given output

success

Step-7 : Check firewalld whether rules are added or not using a given command

[root@techbrown ~]# firewall-cmd –list-all

Step-8 : List the disk which we want to install the ISCSI Target

[root@techbrown ~]# lsblk

We have found it using this list and In our case we are using /dev/vdb

Step-9 : Create the Partition for the /dev/vdb

[root@techbrown ~]# fdisk /dev/vdb

It will show given output and add the new partition using given parameter

Command (m for help): p
Device Boot Start Start End Blocks ID System
/dev/vdb1 2048 2048 472143871 236070912 83 Linux
/dev/vdb2 472143872 4722143872 488396799 8126464 82 Linux swap /Solaris
command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): e
Partition number (1-4, default 1):
First sector (2048-20971519, default 2048) :
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519) :
Using default value 20971519
Partition 1 of type Extended and of size 10 GiB is set
Command (m for help): n
Partition type:
p primary (0 primary, 1 extended, 3 free)
l logical (numbered from 5)
Select (default p): l
Adding logical partition 5
First sector (4096-20971519, default 4096):
Using default value 4096
Last sector, +sectors or +size{K,M,G} (4096-20971519, default 20971519) : +4G
Partition 5 of type Linux and of size 4 GiB is set
Command (m for help): t
Partition number (1,5, default 5): 5
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.

Step-10 : Reload and write the disk partition

[root@techbrown ~]# partprobe

Step-11 : Check the partition that you have created

[root@techbrown ~]# fdisk -l

It will show given output

Advertisement. Scroll to continue reading.
Device Boot Start End Blocks ID System
/dev/vdb1 2048 472143871 236070912 83 Linux
/dev/vdb2 472143872 488396799 8126464 82 Linux swap /Solaris
/dev/vdb5 488296780 758434594 563385394 81 Linux lvm

Step-12 : Create the Physical volume

[root@techbrown ~]# pvcreate /dev/vdb5

It will show given output

Physical volume "/dev/vda5" successfully created

Step-13 : Create the Volume Group

[root@techbrown ~]# vgcreate techbrown-vg /dev/vdb5

It will show given output

Volume group "techbrown-vg" successfully created

Step-14 : Create the Logical Volume

[root@techbrown ~]# lvcreate -L 3G -n techbrown-lvm techbrown-vg

It will show given output

Logical volume "techbrown-lvm" created

Step-15 : Check Whether LVM is created or not by using given command

[root@techbrown ~]# lsblk

Step-16 : When you have verified now lets move to the targetcli

[root@techbrown ~]# targetcli

It will show given output and type the command as shown as below

Advertisement. Scroll to continue reading.
>ls
>/backstore/block create iscsi_store /dev/techbrown-vg/techbrown-lvm
>iscsi create iqn.2015-06.com.techbrown:techbrownserver
>iscsi/iqn.2015-06.com.techbrown:techbrownserver/tpg1/acls create iqn.2015-06.com.techbrown:techbrowndesktop
>iscsi/iqn.2015-06.com.techbrown:techbrownserver/tpg1/luns create /backstore/block/iscsi_store
>iscsi/iqn.2015-06.com.techbrown:techbrownserver/tpg1/portals create 172.25.26.11
>ls
>saveconfig
Last 10 configs saved in /etc/target/backup.
Configuration saved to /etc/target/saveconfig.json
>exit
Global pref auto_save_on_exit=true
Last 10 configs saved in /etc/target/backup.
Configuration saved to /etc/target/saveconfig.json

Step-17 : When you have completed now restart the target services to make changes in the effect.

[root@techbrown ~]# systemctl restart target

Step-18 : Reload the firewalld to flush the old firewall rules and implement the new one

[root@techbrown ~]# firewall-cmd --reload

Conclusion: Now you have successfully installed the targetcli packages and configured the ISCSI target server this is useful to enable the storage networking. This storage can be useful to mount at various locations using ISCSI Initiator that is explained in our next tutorial also this thing can be found on our blog. If you have any questions or doubts in your mind feel free to use the comment section below.

Comments
Advertisement
Advertisement
Advertisement

You May Also Like

Windows

How to auto upgrade JioFi firmware for JioFi 2 / JioFi 3 / JioFi 4 / JioFi 5 / JioFi 6 and other JioFi...

Windows

Internet is the most important public network for connecting to the WEB. For internet connection requirement the ISP is required as well as it...

Windows

How to download and install the Mobile Intel 4 Series Express Chipset Graphics Drivers for Windows 10.  Windows 10 is the one of the...

Windows

How to Install and Configure PCSX2 on Windows 10. The Windows 10 is the most recommended operating system for the Games. In stream platform...