iSCSI : Configure Initiator2024/11/01 |
Configure iSCSI Initiator.
This example is based on the environment like follows.
+----------------------+ | +----------------------+ | [ iSCSI Target ] |10.0.0.30 | 10.0.0.51| [ iSCSI Initiator ] | | dlp.srv.world +----------+----------+ node01.srv.world | | | | | +----------------------+ +----------------------+ |
[1] | Configure iSCSI Initiator to connect to iSCSI Target. |
[root@node01 ~]#
dnf -y install iscsi-initiator-utils
[root@node01 ~]#
vi /etc/iscsi/initiatorname.iscsi # set to the same IQN you set on the iSCSI target server InitiatorName=iqn.2024-11.world.srv:node01.initiator
[root@node01 ~]#
vi /etc/iscsi/iscsid.conf # line 74 : uncomment node.session.auth.authmethod = CHAP # line 86,87 : uncomment and specify the username and password you set on the iSCSI target server node.session.auth.username = username node.session.auth.password = password
# discover target [root@node01 ~]# iscsiadm -m discovery -t sendtargets -p 10.0.0.30 10.0.0.30:3260,1 iqn.2024-11.world.srv:dlp.target01 # confirm status after discovery [root@node01 ~]# iscsiadm -m node -o show # BEGIN RECORD 6.2.1.10 node.name = iqn.2024-11.world.srv:dlp.target01 node.tpgt = 1 node.startup = automatic node.leading_login = No iface.iscsi_ifacename = default ..... ..... node.conn[0].iscsi.DataDigest = None node.conn[0].iscsi.IFMarker = No node.conn[0].iscsi.OFMarker = No # END RECORD # login to the target # if logout ⇒ iscsiadm --mode node --logoutall=all [root@node01 ~]# iscsiadm -m node --login -p 10.0.0.30 Logging in to [iface: default, target: iqn.2024-11.world.srv:dlp.target01, portal: 10.0.0.30,3260] Login to [iface:[ 1694.174351] sd 6:0:0:0: [sdb] Preferred minimum I/O size 512 bytes default, target[ 1694.174841] sd 6:0:0:0: [sdb] Optimal transfer size 8388608 bytes : iqn.2024-11.world.srv:dlp.target01, portal: 10.0.0.30,3260] successful. # confirm the established session [root@node01 ~]# iscsiadm -m session -o show tcp: [1] 10.0.0.30:3260,1 iqn.2024-11.world.srv:dlp.target01 (non-flash) # confirm the partitions [root@node01 ~]# cat /proc/partitions major minor #blocks name 11 0 1048575 sr0 252 0 31457280 sda 252 1 1024 sda1 252 2 1048576 sda2 252 3 30405632 sda3 253 0 15728640 dm-0 251 0 3998720 zram0 8 0 10485760 sdb # added new device provided from the target server as [sdb]
|
[2] | After setting iSCSI device, configure on Initiator to use it like follows. |
# create label [root@node01 ~]# parted --script /dev/sdb "mklabel gpt" # create partition [root@node01 ~]# parted --script /dev/sdb "mkpart primary 0% 100%" # format with XFS [root@node01 ~]# mkfs.xfs /dev/sdb1 meta-data=/dev/sdb1 isize=512 agcount=4, agsize=655232 blks = sectsz=4096 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=0 = reflink=1 bigtime=1 inobtcount=1 data = bsize=4096 blocks=2620928, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1 log =internal log bsize=4096 blocks=16384, version=2 = sectsz=4096 sunit=1 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0[root@node01 ~]# mount /dev/sdb1 /mnt [root@node01 ~]# df -hT Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/fedora-root xfs 15G 2.0G 14G 13% / devtmpfs devtmpfs 4.0M 0 4.0M 0% /dev tmpfs tmpfs 2.0G 0 2.0G 0% /dev/shm tmpfs tmpfs 782M 1.1M 781M 1% /run tmpfs tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-journald.service tmpfs tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-network-generator.service tmpfs tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-udev-load-credentials.service tmpfs tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-sysctl.service tmpfs tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-tmpfiles-setup-dev-early.service tmpfs tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-tmpfiles-setup-dev.service tmpfs tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-vconsole-setup.service tmpfs tmpfs 2.0G 0 2.0G 0% /tmp /dev/vda2 xfs 960M 316M 645M 33% /boot tmpfs tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-tmpfiles-setup.service tmpfs tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-resolved.service tmpfs tmpfs 1.0M 0 1.0M 0% /run/credentials/getty@tty1.service tmpfs tmpfs 1.0M 0 1.0M 0% /run/credentials/serial-getty@ttyS0.service tmpfs tmpfs 391M 4.0K 391M 1% /run/user/0 /dev/sdb1 xfs 10G 227M 9.8G 3% /mnt |
Sponsored Link |