So we're now going to use our AlmaLinux 8 system as an iSCSI target
sharing out block devices as a storage area network.
We can install the required software, so targetcli, and with
that done, we can run the Python command,
targetcli.
This is an interactive command.
We can use the ls command once we're at our targetcli prompt, and
it will show us what is created by default, and we should just
see a structure without any objects.
The nice thing is that we can go in and create a disk file
to use as a target straightaway. Here we're going through
and creating a file back‑end, we're calling it targetdisk1.
The back‑end itself is going to be /root/targetdisk1,
and we're setting it to be 1 GB.
We can then go through to our iSCSI directory and create an iSCSI target.
So with this, we define a unique name, and often it's the
date and the reverse of the DNS name.
Again, we can go through and use list at any time that we want.
Now that we've got the iSCSI target,
we can go through and move in to our iSCSI directory through to the IQN.
And moving into the target group 1, and here we're going to
create a logical unit, a LUN. And this is where we link the
target through to the back‑end storage.
We can add in an ACL.
The ACL then is making reference to our client.
We must make sure that the client who is connecting to
this will have the same IQN name.
We can then move to the root of our file system and run ls if we
want, but we're just going to exit out, and that's our settings
that have been saved into a JSON file.
Moving across onto the Ubuntu client,
we can check that we've got open‑iscsi installed. We can set
the initiator name to the same name that we used within the
access control list, and that's written through to the
/etc/iscsi/initiatorname.iscsi file.
We can then restart the iSCSI daemon and open iSCSI service.
We can connect into our target using the IP address of your AlmaLinux system,
and that will then show a list of targets that are available.
We will only have one.
That's very easy then to be able to log into that target.
Once we've done that, listing our block devices should show that we've
got an extra 1 GB block device showing. We can now use this any way
that we would like. Now the best way for us to learn is to go out and
see this from the demonstrations.
So we're going to come back with a couple of demonstrations where we're setting up both the server and the client.