[2] iSCSI Initiator
8 czerwca 2020Przykłady tutaj opierają się na następującym schemacie sieci:
[1] Skonfiguruj iSCSI Initiator aby połączyć się z iSCSI Target
[root@lsr02vm ~]# dnf install iscsi-initiator-utils [root@lsr02vm ~]# mcedit /etc/iscsi/initiatorname.iscsi # zmień nazwę IQN na taką jaką ustawiłeś w iSCSI Target na serwerze InitiatorName=iqn.2020-06.lab.zicher:node01.initiator01 [root@lsr02vm ~]# mcedit /etc/iscsi/iscsid.conf # linia 58: odkomentuj node.session.auth.authmethod = CHAP # linia 62,63: odkomentuj i wpisz nazwę użytkownika i hasło takie, jakie ustawiłeś w iSCSI Target na serwerze node.session.auth.username = username node.session.auth.password = password # poszukaj Target'u [root@lsr02vm ~]# iscsiadm -m discovery -t sendtargets -p 192.168.100.1 192.168.100.1:3260,1 iqn.2020-06.lab.zicher:lsr01vm.target01 # potwierdź status po znalezieniu Target'u [root@lsr02vm ~]# iscsiadm -m node -o show # BEGIN RECORD 2.0-877 node.name = iqn.2020-06.lab.zicher:lsr01vm.target01 node.tpgt = 1 node.startup = automatic node.leading_login = No iface.iscsi_ifacename = default iface.net_ifacename = <empty> iface.ipaddress = <empty> iface.prefix_len = 0 iface.hwaddress = <empty> iface.transport_name = tcp iface.initiatorname = <empty> iface.state = <empty> iface.vlan_id = 0 iface.vlan_priority = 0 iface.vlan_state = <empty> iface.iface_num = 0 iface.mtu = 0 iface.port = 0 iface.bootproto = <empty> iface.subnet_mask = <empty> iface.gateway = <empty> iface.dhcp_alt_client_id_state = <empty> iface.dhcp_alt_client_id = <empty> iface.dhcp_dns = <empty> iface.dhcp_learn_iqn = <empty> iface.dhcp_req_vendor_id_state = <empty> iface.dhcp_vendor_id_state = <empty> iface.dhcp_vendor_id = <empty> iface.dhcp_slp_da = <empty> iface.fragmentation = <empty> iface.gratuitous_arp = <empty> iface.incoming_forwarding = <empty> iface.tos_state = <empty> iface.tos = 0 iface.ttl = 0 iface.delayed_ack = <empty> iface.tcp_nagle = <empty> iface.tcp_wsf_state = <empty> iface.tcp_wsf = 0 iface.tcp_timer_scale = 0 iface.tcp_timestamp = <empty> iface.redirect = <empty> iface.def_task_mgmt_timeout = 0 iface.header_digest = <empty> iface.data_digest = <empty> iface.immediate_data = <empty> iface.initial_r2t = <empty> iface.data_seq_inorder = <empty> iface.data_pdu_inorder = <empty> iface.erl = 0 iface.max_receive_data_len = 0 iface.first_burst_len = 0 iface.max_outstanding_r2t = 0 iface.max_burst_len = 0 iface.chap_auth = <empty> iface.bidi_chap = <empty> iface.strict_login_compliance = <empty> iface.discovery_auth = <empty> iface.discovery_logout = <empty> node.discovery_address = 192.168.100.1 node.discovery_port = 3260 node.discovery_type = send_targets node.session.initial_cmdsn = 0 node.session.initial_login_retry_max = 8 node.session.xmit_thread_priority = -20 node.session.cmds_max = 128 node.session.queue_depth = 32 node.session.nr_sessions = 1 node.session.auth.authmethod = CHAP node.session.auth.username = username node.session.auth.password = ******** node.session.auth.username_in = <empty> node.session.auth.password_in = <empty> node.session.timeo.replacement_timeout = 120 node.session.err_timeo.abort_timeout = 15 node.session.err_timeo.lu_reset_timeout = 30 node.session.err_timeo.tgt_reset_timeout = 30 node.session.err_timeo.host_reset_timeout = 60 node.session.iscsi.FastAbort = Yes node.session.iscsi.InitialR2T = No node.session.iscsi.ImmediateData = Yes node.session.iscsi.FirstBurstLength = 262144 node.session.iscsi.MaxBurstLength = 16776192 node.session.iscsi.DefaultTime2Retain = 0 node.session.iscsi.DefaultTime2Wait = 2 node.session.iscsi.MaxConnections = 1 node.session.iscsi.MaxOutstandingR2T = 1 node.session.iscsi.ERL = 0 node.session.scan = auto node.session.reopen_max = 0 node.conn[0].address = 192.168.100.1 node.conn[0].port = 3260 node.conn[0].startup = manual node.conn[0].tcp.window_size = 524288 node.conn[0].tcp.type_of_service = 0 node.conn[0].timeo.logout_timeout = 15 node.conn[0].timeo.login_timeout = 15 node.conn[0].timeo.auth_timeout = 45 node.conn[0].timeo.noop_out_interval = 5 node.conn[0].timeo.noop_out_timeout = 5 node.conn[0].iscsi.MaxXmitDataSegmentLength = 0 node.conn[0].iscsi.MaxRecvDataSegmentLength = 262144 node.conn[0].iscsi.HeaderDigest = None node.conn[0].iscsi.DataDigest = None node.conn[0].iscsi.IFMarker = No node.conn[0].iscsi.OFMarker = No # END RECORD # zaloguj się do Target'u [root@lsr02vm ~]# iscsiadm -m node --login Logging in to [iface: default, target: iqn.2020-06.lab.zicher:lsr01vm.target01, portal: 192.168.100.1,3260] Login to [iface: default, target: iqn.2020-06.lab.zicher:lsr01vm.target01, portal: 192.168.100.1,3260] successful. # potwierdź stabilność sesji [root@lsr02vm ~]# iscsiadm -m session -o show tcp: [1] 192.168.100.1:3260,1 iqn.2020-06.lab.zicher:lsr01vm.target01 (non-flash) # potwierdź partycje [root@lsr02vm ~]# cat /proc/partitions major minor #blocks name 8 0 8388608 sda 8 1 1048576 sda1 8 2 7339008 sda2 11 0 1048575 sr0 253 0 6496256 dm-0 253 1 839680 dm-1 8 16 1048576 sdb # została dodana nowa partycja z Target'u jako [sdb]
[2] Po ustawieniu urządzenia iSCSI skonfiguruj Initiator w celu jego użycia.
# stwórz opis (label) [root@lsr02vm ~]# parted --script /dev/sdb "mklabel gpt" # stwórz partycję [root@lsr02vm ~]# parted --script /dev/sdb "mkpart primary 0% 100%" # sformatuj ją jako XFS [root@lsr02vm ~]# mkfs.xfs -i size=512 -s size=1024 /dev/sdb1 meta-data=/dev/sdb1 isize=512 agcount=4, agsize=65534 blks = sectsz=1024 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=0 = reflink=1 data = bsize=4096 blocks=262135, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1 log =log wewnętrzny bsize=4096 blocks=1257, version=2 = sectsz=1024 sunit=1 blks, lazy-count=1 realtime =brak extsz=4096 blocks=0, rtextents=0 [root@lsr02vm ~]# mount /dev/sdb1 /mnt [root@lsr02vm ~]# df -hT System plików Typ rozm. użyte dost. %uż. zamont. na devtmpfs devtmpfs 475M 0 475M 0% /dev tmpfs tmpfs 491M 0 491M 0% /dev/shm tmpfs tmpfs 491M 6,6M 485M 2% /run tmpfs tmpfs 491M 0 491M 0% /sys/fs/cgroup /dev/mapper/cl_lsr01vm-root xfs 6,2G 1,5G 4,7G 25% / /dev/sda1 ext4 976M 153M 756M 17% /boot /dev/sdb1 xfs 1020M 40M 980M 4% /mnt tmpfs tmpfs 99M 0 99M 0% /run/user/0