This is a very similar article to this; however, we are using the last version of iscsitarget available for the 2.4 kernel. We wanted to bring up a simple iSCSI box quickly to serve as a target for our Mac OS X iSCSI Initiator article. We are working on a generic 2.6 kernal install procedure for a future article. We used the root filesystem from here, which means that we are starting from a very basic system. We are using version 2.4.32 of the Linux kernel. We are using the block device from our LVM setup in this article to share the extra space on the hard drive via iSCSI. With this version of iscsitarget only block devices can be used, so we can use the block device created with LVM. Of course, LVM has other advantages as well. Anyway, grab the source from here, extract, compile, and install:
sv-1# tar -xzf iscsitarget-0.3.8.tar.gz sv-1# cd iscsitarget-0.3.8 sv-1# make KERNELSRC=../linux-2.4.32 make -C iscsid make[1]: Entering directory `/usr/src/iscsitarget-0.3.8/iscsid' cc -O2 -fno-inline -Wall -Wstrict-prototypes -g -I../include -c -o ietd.o ietd.c . . . e -DKBUILD_BASENAME=file_io -c -o file-io.o file-io.c make[2]: Leaving directory `/usr/src/iscsitarget-0.3.8/kernel' make[1]: Leaving directory `/usr/src/linux-2.4.32' sv-1# sv-1# ln -s /etc/rc.d/init.d /etc/init.d sv-1# make KERNELSRC=../linux-2.4.32 install `iscsid/ietd' -> `/usr/sbin/ietd' `iscsid/ietadm' -> `/usr/sbin/ietadm' . . . install: creating directory `/lib/modules/2.4.32/kernel/iscsi' `kernel/iscsi_trgt.o' -> `/lib/modules/2.4.32/kernel/iscsi/iscsi_trgt.o' `kernel/file-io.o' -> `/lib/modules/2.4.32/kernel/iscsi/fileio.o' depmod -aq sv-1# |
Copy the sample ietd.conf to /etc and edit:
Target iqn.2004-09.com.signalq:storage.lvm Lun 0 /dev/volgroup/logicalvol fileio Alias LVMVOL |
Pretty much arbitrary, and we used the same names as this. Start up the iSCSI target:
sv-1# /etc/init.d/iscsi-target start sv-1# sv-1# cat /proc/net/iet/volume tid:0 name:iqn.2004-09.com.signalq:storage.lvm lun:0 major:fe minor:0 iotype:fileio sv-1# |
If you reboot, it appears that the logical volume from our LVM configuration doesn’t stay active, and the device is invalid. The vgchange -aq command fixes this:
sv-1# vgchange -ay 1 logical volume(s) in volume group "volgroup" now active sv-1# |
Just add the command to the iscsi-target init script:
sv-1# vi /etc/init.d/iscsi-target # Start the iSCSI Enterprise Target. # /usr/sbin/vgchange -ay |
Make a symlink to start the script at startup:
sv-1# ln -s ../init.d/iscsi-target S30network sv-1# pwd /etc/rc.d/rc3.d sv-1# |
If you have chkconfig, see this article.