SYS: Configure an iSCSI target.

Share this link

To create an iSCSI target, you need to follow several steps on a dedicated server.

Install the following package:

# yum install -y scsi-target-utils

Activate the tgtd service at boot:

# chkconfig tgtd on

Start the tgtd service:

# service tgtd start

Create a dedicated directory:

# mkdir -p /var/lib/tgtd/kvmguests

Create a specific file (here 512MB):

# dd if=/dev/zero of=/var/lib/tgtd/kvmguests/shareddata.img bs=1M count=512

Set up SELinux configuration:

# restorecon -R /var/lib/tgtd

Edit the /etc/tgt/targets.conf file and add the following lines at the end:

<target iqn.2008-09.com.example:iscsi.kvmguests>
backing-store /var/lib/tgtd/kvmguests/shareddata.img
</target>

Update the configuration:

# tgt-admin --execute

Check the configuration:

# tgt-admin --show

Add a new rule to the firewall:

# iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 3260 -j ACCEPT

Save the firewall configuration:

# service iptables save

Source: https://www.berrange.com/tags/tgtadm/

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Leave a Reply

Upcoming Events (Local Time)

There are no events.

RHCSA7: Task of the day

Allowed time: 5 minutes.
Create a user called tom. Create a directory named /private. Use an acl to only allow access (rwx) to tom to the private directory.

RHCE7: Task of the day

Allowed time: 10 minutes.
Set up a NFS server that exports the /opt directory in read-only mode.

Follow me on Twitter

Poll for favorite RHEL 7 book

What is your favorite RHEL 7 book to prepare RHCSA & RHCE exams?

View Results

Loading ... Loading ...

Poll for most difficult RHCSA 7 topic

What do you think is the most difficult RHCSA 7 topic?

View Results

Loading ... Loading ...

Poll for most difficult RHCE 7 topic

What do you think is the most difficult RHCE 7 topic?

View Results

Loading ... Loading ...