ISCSI: Difference between revisions
No edit summary |
No edit summary |
||
Line 18: | Line 18: | ||
</pre> | </pre> | ||
'''NOTE:''' | '''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 = | = Add a logical Unit = | ||
Line 53: | Line 53: | ||
</pre> | </pre> | ||
= List Active Targets = | |||
<pre> | |||
tgtadm --lld iscsi --op show --mode target | |||
</pre> | |||
Running the command on my server show the following output. | |||
<pre> | |||
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 | |||
</pre> | |||
= Stopping the tgtd Service = | |||
Currently there is no clean way to stop the tgtd service. | |||
<pre> | |||
killall -9 tgtd | |||
</pre> | |||
= 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. | |||
[[Category : Linux]] | [[Category : Linux]] |
Revision as of 06:25, 27 February 2009
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.
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.