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
Leave a Reply
You must be logged in to post a comment.