Tuesday, March 21, 2023

Configure Storage Server with iSCSI.

 in This Tutorial you will Learn " How To Configure Storage Server with iSCSI On Oracle Linux 9
Configure Storage Server with iSCSI.
Storage server with iSCSI on network is called iSCSI Target, Client Host that connects to iSCSI Target is called iSCSI Initiator.
+----------------------+          |          +----------------------+
| [   iSCSI Target   ] |192.168.1.50 | 192.168.1.40| [ iSCSI Initiator  ] |
__________________________________________________________________________________________________________________________________
Server - Os:  Oracle Linux Server 9.0   64Bit      | IP -192.168.1.50        |Hostname - server.testbox.com
__________________________________________________________________________________________________________________________________
Configure iSCSI Target (Targetcli) -  

cat /etc/system-release ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y
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.2023-03.server.testbox:dlp.target01
cd iqn.2023-03.server.testbox:dlp.target01/tpg1/luns
create /backstores/fileio/disk01
cd ../acls
create iqn.2023-03.server.testbox:node01.initiator01
cd iqn.2023-03.server.testbox:node01.initiator01
set auth userid=username
set auth password=password
exit
ss -napt | grep 3260
systemctl enable target
firewall-cmd --add-service=iscsi-target ; firewall-cmd --runtime-to-permanent
__________________________________________________________________________________________________________________________________
Configure iSCSI Initiator  -
__________________________________________________________________________________________________________________________________
cat /etc/system-release ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y
dnf -y install iscsi-initiator-utils
nano /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2023-03.server.testbox: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.50                   
iscsiadm -m node -o show
systemctl restart iscsid
iscsiadm -m node --login
iscsiadm -m session -o show
cat /proc/partitions

parted --script /dev/sdc "mklabel gpt"
parted --script /dev/sdc "mkpart primary 0% 100%"
mkfs.xfs -i size=1024 -s size=4096 /dev/sdc1
mount /dev/sdc1 /mnt
df -hT
__________________________________________________________________________________________________________________________________

No comments:

Post a Comment