7.6. Preparing and Adding Block-based Storage
7.6.1. Preparing iSCSI Storage
Summary
These steps must be taken to export iSCSI storage device from a server running Red Hat Enterprise Linux 6 to use as a storage domain with Red Hat Enterprise Virtualization.
Procedure 7.9. Preparing iSCSI Storage
- Install the scsi-target-utils package using the
yumcommand as root on your storage server.# yum install -y scsi-target-utils
- Add the devices or files you want to export to the
/etc/tgt/targets.conffile. Here is a generic example of a basic addition to thetargets.conffile:<target iqn.YEAR-MONTH.com.EXAMPLE:SERVER.targetX> backing-store /PATH/TO/DEVICE1 # Becomes LUN 1 backing-store /PATH/TO/DEVICE2 # Becomes LUN 2 backing-store /PATH/TO/DEVICE3 # Becomes LUN 3 </target>Targets are conventionally defined using the year and month they are created, the reversed fully qualified domain that the server is in, the server name, and a target number. - Start the tgtd service.
# service tgtd start
- Make the tgtd start persistently across reboots.
# chkconfig tgtd on
- Open an iptables firewall port to allow clients to access your iSCSI export. By default, iSCSI uses port 3260. This example inserts a firewall rule at position 6 in the INPUT table.
# iptables -I INPUT 6 -p tcp --dport 3260 -j ACCEPT
- Save the iptables rule you just created.
# service iptables save
Result
You have created a basic iSCSI export. You can use it as an iSCSI data domain.