Providing Remote block storage using iSCSI server installation and configuration
ISCSI Server installation and configuration RHEL7 Providing Remote Block Storage
iSCSI means Internet Small computer System Interface, We will use iSCSI connectivity because it is cost effective compare to FC connection.
To provide iSCSI based storage we do not required any extra environment because we can make use of existing Network switches.
We have different types of storage’s such as1. DAS – Directly attached storage
2. NAS – Network Attached Storage
3. SAN – Storage Area Network
iSCSI protocol comes under SAN (Storage Area Network) To allocate remote block storage to clients below are the steps we have to follow
1. Create one Partition
2. Create LVM using that partition (Don’t format)
3. Install iSCSI Utilities if not available
4. Create LUN and Map to iSCSI client
5. iSCSI server = Target. iSCSI Client = Initiator.
6. Client IP = 192.168.72.12 (desktop1)
Installation and Configuration steps into Server side:-
Server IP =192.168.72.11 (Hostname=server1)
Step:-1 -> Creating Partition and convert into LVM :-
Add extra virtual hard drive into Vmware -> virtual Machine settings-> Add harddrive
Here i have add new SCSI HDD called /dev/sdb 100GB with no partitions
[root@server1 ~]# fdisk -l
Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
[root@server1 ~]# fdisk /dev/sdb
Command (m for help): n
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-209715199, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199): +3G
Command (m for help): p
/dev/sdb1 2048 6293503 3145728 83 Linux
Command (m for help): t
Hex code (type L to list all codes): 8e
Command (m for help): p
/dev/sdb1 2048 6293503 3145728 8e Linux LVM
Command (m for help): w
[root@server1 ~]# partprobe
[root@server1 ~]# pvcreate /dev/sdb1
[root@server1 ~]# vgcreate data /dev/sdb1
[root@server1 ~]# lvcreate -L 2.5G -n backup data
[root@server1 ~]# pvdisplay
[root@server1 ~]# vgdisplay
[root@server1 ~]# lvdisplay
LV Path /dev/data/backup
LV Name backup
VG Name data
LV Size 2.50 GiB
Step:-2 -> Install ISCSI Target storage server that provides remote block storage
[root@server1 ~]# yum install targetcli.noarch –y
Step:-3 start iscsi remote storage services
[root@server1 ~]# systemctl enable target.service
[root@server1 ~]# systemctl restart target.service
Step:-4 -> add client IQN in server, Create New LUN using existing LVM and map to client and Portal creation with clients IP address
Targetcli is the command to enter into iscsi console
[root@server1 ~]# targetcli
/> ls
/> /backstores/block create disk1 /dev/data/backup
Create Storage Object and Create IQN (iSCSI Qualified Name) to map LUN. This IQN we should take from iSCSI client machine
/> /iscsi create iqn.2018-01.com.example:server1
Created target iqn.2018-01.com.example:server1.
/> /iscsi/iqn.2018-01.com.example:server1/tpg1/acls create iqn.2018-01.com.example:desktop1
Created Node ACL for iqn.2018-01.com.example:desktop1.
/> /iscsi/iqn.2018-01.com.example:server1/tpg1/luns create /backstores/block/disk1
Created LUN 0.
Created LUN 0->0 mapping in node ACL iqn.2018-01.com.example:desktop1
/> /iscsi/iqn.2018-01.com.example:server1/tpg1/portals create 192.168.72.12 3260
Using default IP port for iscsi is 3260
/> saveconfig
Step:-5 -> Allow Firewall Port to communicate with iSCSI Client
[root@server1 ~]# firewall-cmd --permanent --add-port=3260/tcp
[root@server1 ~]# firewall-cmd –reload
ISCSI Client side Configuration Using with iSCSI initiators
Step:-1 -> Client side we have to install iscsi-initiator utilities to connect iscsi Storage target server.[root@desktop1 ~]# yum install iscsi-initiator-utils.i686 –y
Step:-2 -> Get IQN from Client machine and add to server for mapping disk from server.
[root@desktop1 ~]# vim /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2018-01.com.example:desktop1
Step:-3 -> Enable and Start iscsid service
[root@desktop1 ~]# systemctl enable iscsi.service
[root@desktop1 ~]# systemctl restart iscsi.service
Step:-4 -> Client Side to connect iSCSI target server LUN using with iscsi initiator
[root@desktop1 ~]# iscsiadm -m discovery -t st -p 192.168.72.11
192.168.72.11:3260,1 iqn.2018-01.com.example:server1
[root@desktop1 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb 8:16 0 2.5G 0 disk
Step:-5 -> After successful mapping of LUN now you can create file system on LUN and Permanent mount using with /etc/fstab entries.
[root@desktop1 ~]# mkfs -t xfs /dev/sdb
[root@desktop1 ~]# mkdir /mnt/iscsi
[root@desktop1 ~]# blkid
/dev/sdb: UUID="2fe9402e-f4f4-4b9a-87d2-278600ffc812" TYPE="xfs"
[root@desktop1 ~]# vim /etc/fstab
UUID=2fe9402e-f4f4-4b9a-87d2-278600ffc812 /mnt/iscsi xfs _netdev 0 2
[root@desktop1 ~]# mount –a
[root@desktop1 ~]# df –h
Filesystem Size Used Avail Use% Mounted on
/dev/sdb 2.5G 33M 2.5G 2% /mnt/iscsi
No comments:
Post a Comment