ISCSI: Difference between revisions
No edit summary |
|||
Line 96: | Line 96: | ||
= Possible Bug = | = Possible Bug = | ||
When I reboot my Linux server it no longer displays or recognises any active targets. To get around this problem I add the commands to the servers start file as to configure active targets at boot. | When I reboot my Linux server it no longer displays or recognises any active targets. To get around this problem I add the commands to the servers start file as to configure active targets at boot. | ||
== Created File == | |||
<pre> | |||
vi /opt/mount-iscsi-initiator | |||
</pre> | |||
paste the follwing contents. | |||
<pre> | |||
tgtadm --lld iscsi --op new --mode target --tid 1 --targetname myvideofiles | |||
tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/hda4 | |||
tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL | |||
</pre> | |||
== Add to Start Up File == | |||
<pre> | |||
vi /etc/rc.d/rc.local | |||
</pre> | |||
add the line | |||
<pre> | |||
/opt/mount-iscsi-initiator | |||
</pre> | |||
[[Category : Linux]] | [[Category : Linux]] |
Latest revision as of 10:57, 4 March 2009
Introduction
This procedure will allow you to have a partition on a Linux server and then mount that partition on another Linux, Mac or Windows computer as an iSCSI device. On your host computer you need an allocated hard disk or a partition of a hard disk to be used as an iSCSI target.
All of the information below is available from the installation documentation.
/usr/share/doc/scsi-target-utils-0.0/README.iscsi
Installation
Lets get started by installing the iSCSI initiator on the Linux host.
yum install scsi-target-utils
Service Startup at Boot
chkconfig tgtd on service tgtd start
Create a new target
tgtadm --lld iscsi --op new --mode target --tid 1 --targetname myvideofiles
NOTE: The target name must be in lowercase for windows to be able to successfully connect to it. If you have uppercase characters in the name you will get errors on connection.
Add a logical Unit
tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/hda4
NOTE: In this example I have created a partition that I will be using. That is why I have specified /dev/hda4. You may have specified /dev/hda or /dev/hdb for a whole hard disk, depending on your configuration.
Security
Allow All Initiators
tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
This command will allow anyone to connect which is obviously insecure.
Based on IP Address
Individual IP
tgtadm --lld iscsi --op bind --mode target --tid 1 -I 10.10.0.24
Based on Subnet
tgtadm --lld iscsi --op bind --mode target --tid 1 -I 10.10.0.0/24
Authentication (CHAP)
First, create a user and password
tgtadm --lld iscsi --op new --mode account --user ''consumer'' --password ''Longsw0rd''
Next, add the users to an existing target device
tgtadm --lld iscsi --op bind --mode account --tid 1 --user ''consumer''
List Active Targets
tgtadm --lld iscsi --op show --mode target
Running the command on my server show the following output.
Target 1: myvideofiles System information: Driver: iscsi Status: running I_T nexus information: LUN information: LUN: 0 Type: controller SCSI ID: deadbeaf1:0 SCSI SN: beaf10 Size: 0 Backing store: No backing store LUN: 1 Type: disk SCSI ID: deadbeaf1:1 SCSI SN: beaf11 Size: 65G Backing store: /dev/hda4 Account information: ACL information: ALL
Stopping the tgtd Service
Currently there is no clean way to stop the tgtd service.
killall -9 tgtd
Possible Bug
When I reboot my Linux server it no longer displays or recognises any active targets. To get around this problem I add the commands to the servers start file as to configure active targets at boot.
Created File
vi /opt/mount-iscsi-initiator
paste the follwing contents.
tgtadm --lld iscsi --op new --mode target --tid 1 --targetname myvideofiles tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/hda4 tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
Add to Start Up File
vi /etc/rc.d/rc.local
add the line
/opt/mount-iscsi-initiator