From the course: Red Hat Enterprise Linux 8 Essential Training

Create iSCSI target

From the course: Red Hat Enterprise Linux 8 Essential Training

Start my 1-month free trial

Create iSCSI target

- [Instructor] Previously in this chapter, we created a fileio backstore. Let's verify this before moving on. Make sure your rhhost1 VM is booted and you're logged in. In a terminal, run targetcli using sudo. Type in sudo targetcli and hit Enter. Type in your password if prompted. If it's already running, you can skip this step. Now type in ls to verify that the backstore exists. Type in ls and hit Enter. We see the fileio-based backstore but no targets, LUNs or ACLs. Let's create a target now. First, let's move to the iSCSI directory. Type in cd /iscsi and hit Enter. Type ls to see a brief output showing only targets. In this case, we don't have one yet. Now create a target with the create sub-command. Type in create and hit Enter. We see output on the screen telling us that it created a target with a very long name. It also created a target portal group. If you're using Enterprise Linux 7.1 or newer, it automatically creates a portal when you create a target. If you're using an older version, you'll need to create a portal manually. We will not cover creating portals in this course. Let's also see what this looks like in the hierarchy using ls. Type in ls and hit Enter. We see that we have a target, a target portal group, a portal but no LUNs or ACLs. If we want a target name that means more to us, we can specify it when we create. Let's create a new target and specify the name this time. Type in create iqn.2018-04.com.localnet:filedisk1 and hit Enter. We used the domain name for this course, which when reversed is com.localnet. Lastly, following an optional colon can be a string of characters containing an identifier. This identifier might be the product type, serial number, host identifier or even a software key. In fact, it could be anything the administrator wants in order to identify the target. Note that the string can include most characters, including other colons. In this example, I chose to keep it simple and use the filedisk1. The structure for the iqn is defined in RFC 3720 if you'd like to read more. To view the hierarchy again, type in ls. We can see that we now have two targets, the auto-created one and our user-defined target below that. Since we only need one target, at this point, let's delete the auto-named one. Highlight the target name and copy it and then type in delete and then paste in the name and hit Enter. We can verify this with ls. We now have one target that we defined with a name that is unique but easy to understand.

Contents