LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-08-2014, 07:09 AM   #1
dreamqq
LQ Newbie
 
Registered: Jun 2014
Posts: 11

Rep: Reputation: Disabled
ISCSI target over Ethernet, help needed


Hello,
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:
https://ieee1394.wiki.kernel.org/index.php/Sbp-target

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.

Code:
#!/bin/bash
export CONFIGFS=/sys/kernel/config/
export TARGET=/sys/kernel/config/target/core/
export FABRIC=/sys/kernel/config/target/iscsi/

# 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
 
Old 07-08-2014, 05:41 PM   #2
kentyler
Member
 
Registered: Dec 2008
Location: Cleveland Ohio
Distribution: CentOS
Posts: 235

Rep: Reputation: 36
You don't need to export the variables unless you expect to use them outside of the script for another script so remove the export and just assign them and enclose within double quotes VARIABLE="VALUE"

CONFIGFS="/sys/kernel/config/"
TARGET="/sys/kernel/config/target/core/"
FABRIC="/sys/kernel/config/target/iscsi/"

Otherwise it looks like it will work.
 
Old 07-10-2014, 11:50 AM   #3
dreamqq
LQ Newbie
 
Registered: Jun 2014
Posts: 11

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by kentyler View Post
You don't need to export the variables unless you expect to use them outside of the script for another script so remove the export and just assign them and enclose within double quotes VARIABLE="VALUE"

CONFIGFS="/sys/kernel/config/"
TARGET="/sys/kernel/config/target/core/"
FABRIC="/sys/kernel/config/target/iscsi/"

Otherwise it looks like it will work.
Thank you very much, I know that, I was using this code in another script and just copy past without deleting them :-)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Iscsi target on Freenas 7 or 8 jefro *BSD 5 01-03-2011 05:39 PM
install livecd to iscsi target aclhkaclhk Linux - Software 1 01-30-2010 07:24 PM
ISCSI target image sizing nowlinuxed Linux - General 1 10-19-2009 03:05 AM
changes on other iscsi nodes attached to an ext3 iscsi target not being seen sldahlin Linux - Server 1 06-07-2008 03:02 AM
can we make iscsi target in fedora 8 gopals Linux - Software 0 02-29-2008 10:23 PM


All times are GMT -5. The time now is 08:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration