Need to install the software needed to do the things below ? So, go here…
Add a iSCSI target
So, it's time to configure some target, and use it on other system.
To specify a block device to be available through iSCSI for other system. You have to edit a file, this one :
If it don't exist, let's create it (as root user):
# touch /etc/ietd.conf
I will only add an entire block device, to be as easy as possible.
The simpliest content of the file may contains something like that :
Lun 1 Path=/dev/sdc
What's does all means ?
First of all, the thing in bold are the ones that needs to customized to your needs.
By instance, the strange name after target keyword is the name of your iSCSI target on the network, see wikipedia for more information about the strange name. This is the name that referred to your iSCSI device on the network.
The number after lun keyword is an internal identifier for iSCSI target on the local system running the iSCSI target. So, there should only be one on the systemn, so two iSCSI disk must have different lun number. Otherwise, you will get an error.
And finally, as you might guess, after :
you have to write there the block device that you want to export across the network through iSCSI protocol.
So, to be clear, let's take an example.
We want to export the device :
with LUN number :
and a name1 of :
So, the configuration file ( /etc/ietd.conf ) have to look like to :
Lun 3 Path=/dev/hdc
Now, check first if the iSCSI daemon is already running :
and if's not started, let's start it with :
# /etc/init.d/iscsitarget start
If all goes properly, you will get this output :
Starting iSCSI enterprise target service: succeeded.
That's it ! Others computer on your lan or across internet can now use your iSCSI device.
Go here to known how to use this new iSCSI device from other computer.
List the available target
If you want to see all the iSCSI target available for other host, you can first check your :
file, and each line beginning with :
will be a target that other system can reach. This method is not sure, as perhaps someone add an iSCSI device on command line without using the file :
The best method to see which iSCSI device is available for other host, is to run this command :
# cat /proc/net/iet/session
An output will be something like that :
tid:2 name:iqn.2008-04.my_company.knt:katmai-disk-d tid:1 name:iqn.2008-04.my_company.knt:katmai sid:281474980708864 initiator:iqn.1993-08.org.debian:01.aa231de29b62 cid:0 ip:192.168.1.193 state:active hd:none dd:none
What does it means ?
Each line beginning with :
is an iSCSI device. So, in this example, there is 2 iSCSI device :
- tid:2 name:iqn.2008-04.my_company.knt:katmai-disk-d
- tid:1 name:iqn.2008-04.my_company.knt:katmai
There is still 2 others lines with indentation below :
it means that the corresponding iSCSI target, so this one :
is used by someone.
So, as you might gues, the first iSCSI target :
isn't used by any other host on the network.