Iscsi: Difference between revisions
Jump to navigation
Jump to search
(Created page with "=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. ==In...") |
|||
Line 4: | Line 4: | ||
==Install target== | ==Install target== | ||
dnf -y install scsi-target-utils | dnf -y install scsi-target-utils | ||
==Create a disk image== | |||
mkdir /ssd/iscsi | mkdir /ssd/iscsi | ||
dd if=/dev/zero of=/ssd/iscsi/target001.img count=0 bs=1 seek=10G | dd if=/dev/zero of=/ssd/iscsi/target001.img count=0 bs=1 seek=10G | ||
Line 17: | Line 17: | ||
incominguser username password | incominguser username password | ||
</target> | </target> | ||
If selinux. | ==If selinux.== | ||
chcon -R -t tgtd_var_lib_t /ssd/iscsi | chcon -R -t tgtd_var_lib_t /ssd/iscsi | ||
semanage fcontext -a -t tgtd_var_lib_t /ssd/iscsi | semanage fcontext -a -t tgtd_var_lib_t /ssd/iscsi | ||
Open firewall | ==Open firewall== | ||
firewall-cmd --add-service=iscsi-target --permanent | firewall-cmd --add-service=iscsi-target --permanent | ||
firewall-cmd --reload | firewall-cmd --reload | ||
Start | ==Start tgtd== | ||
systemctl enable --now tgtd | systemctl enable --now tgtd | ||
show status | ==show status== | ||
tgtadm --mode target --op show | tgtadm --mode target --op show | ||
Revision as of 19:53, 26 March 2022
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.
Install target
dnf -y install scsi-target-utils
Create a disk image
mkdir /ssd/iscsi dd if=/dev/zero of=/ssd/iscsi/target001.img count=0 bs=1 seek=10G vim /etc/tgt/conf.d/target01.conf <target iqn.2022-03.se.halfface.iscsi:target001> # provided devicce as a iSCSI target backing-store /ssd/iscsi/target001.img # iSCSI Initiator's IQN you allow to connect. Or set nothing to allow all. initiator-name iqn.2022-03.se.halfface.iscsi:node01.initiator01 # initiator-address 10.111.222.13 # authentication info ( set anyone you like for "username", "password" ) incominguser username password </target>
If selinux.
chcon -R -t tgtd_var_lib_t /ssd/iscsi semanage fcontext -a -t tgtd_var_lib_t /ssd/iscsi
Open firewall
firewall-cmd --add-service=iscsi-target --permanent firewall-cmd --reload
Start tgtd
systemctl enable --now tgtd
show status
tgtadm --mode target --op show
Install initiator
dnf -y install iscsi-initiator-utils vim /etc/iscsi/initiatorname.iscsi InitiatorName=iqn.2022-03.se.halfface.iscsi:node01.initiator01 vim /etc/iscsi/iscsid.conf node.session.auth.authmethod = CHAP node.session.auth.username = username node.session.auth.password = password
Start iscsid service.
systemctl enable iscsid.service systemctl restart iscsid.service
Discover target
iscsiadm -m discovery -t sendtargets -p 10.111.222.1 [ 1542.659413] Loading iSCSI transport class v2.0-870. [ 1542.679005] iscsi: registered transport (tcp) 10.0.0.30:3260,1 iqn.2019-11.world.srv:dlp.target01
Confirm status after discovery
[root@node01 ~]# iscsiadm -m node -o show # BEGIN RECORD 2.0-876 node.name = iqn.2019-11.world.srv:dlp.target01 node.tpgt = 1 node.startup = automatic node.leading_login = No iface.iscsi_ifacename = default ... node.conn[0].iscsi.IFMarker = No node.conn[0].iscsi.OFMarker = No # END RECORD
Login to the target
iscsiadm -m node --login Logging in to [iface: default, target: iqn.2019-11.world.srv:dlp.target01, portal: 10.0.0.30,3260] (multiple) Login to [iface: default, target: iqn.2019-11.world.srv:dlp.target01, portal: 10.0.0.30,3260] successful.
Confirm the established session
iscsiadm -m session -o show tcp: [1] 10.0.0.30:3260,1 iqn.2019-11.world.srv:dlp.target01 (non-flash)
Confirm the partitions
lsblk
Format and mount disk
gdisk /dev/sda mount /dev/sda1 /mnt/
- logout from all sessions.
iscsiadm -m node -u