First I don't know if this the right place to post this question or not, so I apologize in advanced if it is not.
I have been looking for a way to export files from a device running custom Linux based OS using ISCSI target over Ethernet. However, I want automate the process by writing a bash script to do that for me like the spb target with FireWire in this link:
So fare, I just found how to set it manually and there are problem with things like the iqn and the ip that you need to write it down. I want the script to do this automatically
This is my attempted in bash script.
# Create the iblock backstore (and mount the scsi)
echo " Creating /sys/kernel/config/target/core/iblock_0/iscsiStore"
mkdir -p $TARGET/iblock_0/iscsiStore
echo " Adding udev_path=dev/$USBev to control"
echo 1 > $TARGET/iblock_0/iscsiStore/control
#echo "readonly=1" > /sys/kernel/config/target/core/iblock_0/iscsiStore/control
echo "Enabling $TARGET/iblock_0/iscsiStore/control "
echo 1 > $TARGET/iblock_0/iscsiStore/enable
Creating the iscsi target
echo " Creating $FABRIC/iqn.2001-04.com.example:storage.lun1 192.168.01.20/luns/lun"
mkdir -p $FABRIC/iqn.2001-04.com.example:storage.lun1 192.168.01.20/luns/lun
echo "Creating link"
ln -s $TARGET/iblock_0/iscsiStore /$FABRIC/iqn.2001-04.com.example:storage.lun1 192.168.01.20/luns/lun
echo "Enabling $FABRIC/iqn.2001-04.com.example:storage.lun1 192.168.01.20/luns/lun
echo 1 > $FABRIC/iqn.2001-04.com.example:storage.lun1/enabled
I don't know if this right and if it's work automatically, could anyone help me please?
Thank you in advanced