Wednesday, February 23, 2022

How To Configure iSCSI Target And Initiator On Rocky Linux 8.5

 in This Tutorial you will Learn " How To Configure iSCSI Target & Initiator On Rocky Linux 8.5"

iSCSI stands for Internet Small Computer Systems Interface, IP-based storage, works on top of internet protocol by carrying SCSI commands over IP network. iSCSI transports block-level data between an iSCSI initiator on a client machine and an iSCSI target on a storage device (server).

iSCSI Target   ] |192.168.1.20 | 192.168.1.80| [ iSCSI Initiator  
|www.primaryhost.com    +----------+----------+    www.tertiary.com
_________________________________________________________________________________________
iSCSI Target  -  ip - 192.168.1.20  - Hostname - www.primaryhost.com   Os:  Rocky Linux 8.5

cat /etc/system-release ; sestatus ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y
dnf makecache ; dnf -y install targetcli
mkdir /var/lib/iscsi_disks
targetcli
cd backstores/fileio
create disk01 /var/lib/iscsi_disks/disk01.img 10G
cd /iscsi
create iqn.2021-07.primaryhost.com:www.target01
cd iqn.2021-07.primaryhost.com:www.target01//tpg1/luns
create /backstores/fileio/disk01
cd ../acls

create iqn.2021-07.primaryhost.com:node01.initiator01
cd iqn.2021-07.primaryhost.com:node01.initiator01
set auth userid=username
set auth password=password
exit
ss -napt | grep 3260
systemctl enable target ; systemctl status target
firewall-cmd --add-service=iscsi-target ; firewall-cmd --runtime-to-permanent

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
iSCSI Initiator -   ip - 192.168.1.80  - Hostname - www.tertiary.com   Os:  Rocky Linux 8.5

cat /etc/system-release ; sestatus ; hostname ; hostname -I  
dnf groupinstall "Development Tools" -y
dnf -y install iscsi-initiator-utils
nano  /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2021-07.primaryhost.com:node01.initiator01

nano /etc/iscsi/iscsid.conf
node.session.auth.authmethod = CHAP
node.session.auth.username = username
node.session.auth.password = password

iscsiadm -m discovery -t sendtargets -p 192.168.1.20
iscsiadm -m node -o show
iscsiadm -m node --login
iscsiadm -m session -o show
cat /proc/partitions

parted --script /dev/sdb "mklabel gpt"
parted --script /dev/sdb1 "mkpart primary 0% 100%"
mkfs.xfs -i size=1024 -s size=4096 /dev/sdb1
mount /dev/sdb1 /mnt
_________________________________________________________________________________________


No comments:

Post a Comment