On Tue, Sep 30, 2008 at 12:06 PM, Joseph L. Casale <JCasale at activenetwerx.com> wrote: > Great, I guess I had better read up on how to create targets, I just assumed it would > be like iet and use text files. What was your mod for the init script? > > jlc > I added the following to my /etc/init.d/tgtd TARG=/etc/iscsi/tgtd.d target_start() { echo -n $"Adding iSCSI targets: " for i in `find ${TARG} -name "target[0-9]*" -type f` ;do source ${i} echo -n "$TGTNAME " ${TGTADM} --op new --mode target --tid=${TID} --targetname=${IQN} ${TGTADM} --op new --mode logicalunit --tid=${TID} --lun=1 --backing-store=${STORAGE} for j in ${NETWORK} ;do ${TGTADM} --op bind --mode target --tid=${TID} --initiator-address=${j} done done echo } target_stop() { echo -n $"Removing iSCSI targets: " for i in `find ${TARG} -name "target[0-9]*" -type f` ;do source ${i} echo -n "$TGTNAME " ${TGTADM} --op delete --mode target --tid=${TID} --targetname=${IQN} done echo } I call target_start() after start() runs and I call target_stop() before stop() runs. Here is the template of the files I am using in the TARG directory: TGTADM=" /usr/sbin/tgtadm --lld iscsi" DATE="2008-02" # Current month and year DOMAIN="com.domain.host" DEV="<device name>" # example sdb STORAGE="/<path>/<dev>" # example /dev/sdb NETWORK="ALL" # Set what networks can access target. Separate network addresses with spaces TID="#" # target id exp. 1 TGTNAME="<template>" # example prod_storage IQN="iqn.${DATE}.${DOMAIN}:${DEV}.${TGTNAME}" Then I name the file target01, target02, etc. When I get the time, I am going to complete an admin script to bring up new targets or take down targets when I need to. It will also check the status of the targets to see who is connected. I can post that once I am done if you are interested. -- Jason Cox