The first step is to add a target, for this the adorable IQNs make a re-appearance # tgtadm -lld iscsi -op new -mode target -tid 1 -targetname :fedora13:iscsi.kvmguests If you have a more recent version circa Fedora 13 / RHEL-6 there is finally a nice configuration file to handle this setup, so those lucky readers can skip ahead. This is true of RHEL5 vintage scsi-target-utils at least. Historically, you had to invoke a series of tgtadm commands to setup the iSCSI target and LUNs and then add them to /etc/rc.d/rc.sysinit to make sure they run on every boot. # restorecon -R /var/lib/tgtd Exporting an iSCSI target and LUNs (the manual way) # dd if=/dev/zero of=/var/lib/tgtd/kvmguests/shareddata.img bs=1M count=512 In this example, two LUNs will be created one thin provisioned (aka sparse file) 10 GB LUN and one fully allocated 500 MB LUN # mkdir -p /var/lib/tgtd/kvmguests Since the guest providing the iSCSI service in this example has no spare block device or LVM space, raw files will have to be used. The Linux SCSI target service does not care whether the LUNs exported are backed by plain files, LVM volumes or raw block devices, though obviously there is some performance overhead from introducing the LVM and/or filesystem layers as compared to block devices. # service tgtd start Allocating storage for the LUNs On Fedora and RHEL servers, the iSCSI target service is provided by the ‘scsi-target-utils’ RPM package, so install that now and set the service to start on boot # yum install scsi-target-utils The first task is to install and enable the iSCSI target service. The iSCSI server in this case is going to be provided by a guest running Fedora 13, x86_64. This article and the one that follows, will show how to provision a guest on iSCSI the “hard way”, using the low level command line tools tgtadm, virsh and virt-install. The previous articles showed how to provision a guest on iSCSI the nice & easy way using a QNAP NAS and virt-manager. Posted: May 5th, 2010 | Filed under: libvirt, Virt Tools | Tags: iscsi, tgtadm | 2 Comments »
0 Comments
Leave a Reply. |