Setting up iSCSI: Difference between revisions

From Alpine Linux
(comment about references)
Line 32: Line 32:
     InitiatorName=iqn.1993-08.org.debian:01:4efa151441
     InitiatorName=iqn.1993-08.org.debian:01:4efa151441


''What does 01 mean? where comes the 4efa151441 number from? Did you made it up? What does it mean?''--[[User:Ncopa|Ncopa]] 08:02, 8 November 2007 (UTC)
''What does 01 mean? where comes the 4efa151441 number from? Did you made it up? What does it mean? Why Debian?''--[[User:Ncopa|Ncopa]] 08:02, 8 November 2007 (UTC)


Verify the file /etc/iscsi/iscsid.conf exists.  If not, it may need to be copied from /etc/iscsid.conf.
Verify the file /etc/iscsi/iscsid.conf exists.  If not, it may need to be copied from /etc/iscsid.conf.

Revision as of 16:08, 8 November 2007

Introduction

iSCSI consists of two pieces: A target and an initiator. A target is a large pool of disk space that can be accessed over IP by the initiators. Initiators use the disk space, formatting it and mounting it the same as local disk.


iSCSI Target

The iscsitarget-X.X.apk package provides the target functionality. It includes the ietd service (ietd is the iSCSI Enterprise Target Daemon). Once the package is installed, you can set up a target by editing two conf files.

In /etc/ietd.conf, add the following information:

       Target iqn.2006-01.com.openfiler:disk2.bpbx-vm-1
              Lun 0 Path=/dev/sda1, Type=fileio

What does the different fields mean? is iqn.2006-01.com.openfiler a hostname? what is disk2.bpbx-vm-1?--Ncopa 07:59, 8 November 2007 (UTC)

The "Target" line above is an example. This line really just needs to be unique. /dev/sdx refers to the disk and partition that will be presented to the initiator.

In the /etc/initiators.allow file, add the following line:

    iqn.2006-01.com.openfiler:disk2.bpbx-vm-1 10.1.194.111

The IP address in the line above will be the initiator's ip address. Now only this ip address is allowed to access this specific target.

Can hostnames be used instead of ip addresses?--Ncopa 08:03, 8 November 2007 (UTC)

iSCSI Initiator

To configure the iSCSI initiator, add the initiator name to the file /etc/iscsi/initiatorname.iscsi

    InitiatorName=iqn.1993-08.org.debian:01:4efa151441

What does 01 mean? where comes the 4efa151441 number from? Did you made it up? What does it mean? Why Debian?--Ncopa 08:02, 8 November 2007 (UTC)

Verify the file /etc/iscsi/iscsid.conf exists. If not, it may need to be copied from /etc/iscsid.conf.

Start the initiator daemon with

/etc/init.d/iscsi start

Connecting the Initiator to the Target

From the iSCSI initiator, first run this command:

    iscsiadm --mode discovery --type sendtargets --portal IP_OF_TARGET

This command contacts the target to determine which disks are available. If all is configured correctly, the target name iqn.2006-01.com.openfiler:disk2.bpbx-vm-1 (from the example above) will be returned.

After the target is discovered, run this command to connect:

    iscsiadm --mode node --targetname NAME_OF_TARGET --portal IP_OF_TARGET --login

Replacing --login with --logout will end the connection.

To make this connection persistent (so that it will reconnect after reboot), run this command:

    iscsiadm -m node -T NAME_OF_TARGET -p IP_OF_TARGET --op update -n node.conn[0].startup -v automatic

Any references/links to where to find more details about it?--Ncopa 16:04, 8 November 2007 (UTC)