DOCS/UNIX/RHEL/ISCSI/Config iSCSI Target : Différence entre versions
Ligne 129 : | Ligne 129 : | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | ==Create fileio storage object== | + | ===Create fileio storage object=== |
<syntaxhighlight lang="shell"> | <syntaxhighlight lang="shell"> | ||
</syntaxhighlight> | </syntaxhighlight> |
Version du 31 août 2022 à 08:00
Sommaire
Sites Références
Cet articles est une transposition sous MediaWiki de ces adresses :
- Configure iSCSI Target on CentOS 9|AlmaLinux 9|RHEL 9
- Configure iSCSI Initiator on CentOS 9|AlmaLinux 9|RHEL 9
iSCSI stands for Internet Small Computer Systems Interface. It is an Internet Protocol that allows multiple servers and users to access network drives remotely over a TCP/IP network by setting up a shared storage network. iSCSI components include the iSCSI target which is the server that stores and allows access to storage and iSCSI initiator which is the hardware installed on a client to send data. A basic Ethernet port or a Host Bus Adapter (HBA) is what is required to connect iSCSI targets and initiators to a network. Both components are identified by a unique name known as iSCSI Qulified Name (iQN).
What is iSCSI Target?
iSCSI target as discussed above is the server that stores the storage and allows access to it. It can be a dedicated physical device on a network or an iSCSI software-configured logical device on a networked storage server. It is the remote storage that appears as a local drive on a host system. The iSCSI protocol then links the host with the storage over IP networks like LAN and WAN or Internet.
This guide shows how to configure an iSCSI Target on CentOS 9|AlmaLinux 9|RHEL 9 systems.
Install iSCSI Target on CentOS 9|AlmaLinux 9|RHEL 9
- Update the system packages.
sudo yum update -y
or
sudo dnf update -y
- Install the targetcli tool
sudo dnf install targetcli
- Start and enable the target service on boot time.
sudo systemctl enable --now target
- Open port 3260 in the firewall.
sudo firewall-cmd --permanent --add-port=3260/tcp sudo firewall-cmd --reload
- To view the targetcli layout, login to the admin console.
$ sudo targetcli
targetcli shell version 2.1.53
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.
/>
- List using the following command
> ls
o- / ..................................................................... [...]
o- backstores .......................................................... [...]
| o- block .............................................. [Storage Objects: 0]
| o- fileio ............................................. [Storage Objects: 0]
| o- pscsi .............................................. [Storage Objects: 0]
| o- ramdisk ............................................ [Storage Objects: 0]
o- iscsi ........................................................ [Targets: 0]
o- loopback ..................................................... [Targets: 0]
- Exit the shell using the following command.
/> exit
Global pref auto_save_on_exit=true
Configuration saved to /etc/target/saveconfig.json
Configure iSCSI Target on CentOS 9|AlmaLinux 9|RHEL 9
To configure an iSCSI Target, we will use the following details
- iSCSI target with a unique iQN.
- iSCSI Backstore – is a storage object that defines the resources that the backstore uses.
- Create iSCSI Portal.
- Setup iSCSI LUN.
- Creating an iSCSI ACL.
- Setup CHAP Authentication.
Create an iSCSI target
The target name is in the iQN format. iQN format is as follows iqn.YYYY-MM.reverse.domain.name:OptionalIdentifier
. Let’s say I was to name a target with an iQN unique string with the name technixleo and my domain is target.example.com the iqn name will be as iqn.2022-06.com.example.target:technixleo
- Login to the admin console of the target CLI shell.
sudo targetcli
- Navigate to the iSCSI directory
/> cd iscsi/
- Create the iSCSI target as shown below.
/iscsi> create iqn.2022-06.com.example.target:technixleo
Created target iqn.2022-06.com.example.target:technixleo.
Created TPG 1.
Global pref auto_add_default_portal=true
Created default portal listening on all IPs (0.0.0.0), port 3260.
- Then verify the created target.
/iscsi> ls
o- iscsi .......................................................... [Targets: 1]
o- iqn.2022-06.com.example.target:technixleo ....................... [TPGs: 1]
o- tpg1 ............................................. [no-gen-acls, no-auth]
o- acls ........................................................ [ACLs: 0]
o- luns ........................................................ [LUNs: 0]
o- portals .................................................. [Portals: 1]
o- 0.0.0.0:3260 ................................................... [OK]
Create iSCSI Backstore
You can create backstore devices of any of the following 4 types
- fileio backstore for files
- block backstore for block devices.
- pscsi backstore for direct pass-through of SCSI commands.
- ramdisk backstore for a temporary RAM-backed device.
For this guide, I will create one for fileio and block backstores
Create fileio storage object
Create a block storage object
Creating an iSCSI Portal
Creating an iSCSI LUN