Difference between revisions of "ISCSI Initiator"

From ArchWiki
Jump to: navigation, search
(Using the Tools: logout + node info)
m (+info how to find dev name of iscsi target)
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
[[Category:Storage]]
 +
[[Category:Networking]]
 
{{Article summary start}}
 
{{Article summary start}}
 
{{Article summary text|How to access an iSCSI Target with an initiator.}}
 
{{Article summary text|How to access an iSCSI Target with an initiator.}}
Line 14: Line 16:
 
The preferred initiator is [http://open-iscsi.org/ Open-iSCSI] as of 2011. An older initiator, [http://sourceforge.net/projects/linux-iscsi/ Linux-iSCSI], was merged with Open-iSCSI.
 
The preferred initiator is [http://open-iscsi.org/ Open-iSCSI] as of 2011. An older initiator, [http://sourceforge.net/projects/linux-iscsi/ Linux-iSCSI], was merged with Open-iSCSI.
 
Linux-iSCSI should not be confused with linux-iscsi.org, the website for the LIO [[iSCSI Target|target]].
 
Linux-iSCSI should not be confused with linux-iscsi.org, the website for the LIO [[iSCSI Target|target]].
 
  
 
== Setup With Open-iSCSI ==
 
== Setup With Open-iSCSI ==
Even {{Package AUR|open-iscsi}} is not in the official repositories, so you need to build it from AUR.
+
Even {{AUR|open-iscsi}} is not in the official repositories, so you need to build it from AUR.
  
 
=== Using the Daemon ===
 
=== Using the Daemon ===
You only have to include the IP of the [[iSCSI Target|target]] as {{Codeline|SERVER}} in {{Filename|/etc/conf.d/open-iscsi}} at the client.
+
You only have to include the IP of the [[iSCSI Target|target]] as {{ic|SERVER}} in {{ic|/etc/conf.d/open-iscsi}} at the client.
  
At the server (target) you might need to include the client iqn from {{Filename|/etc/iscsi/initiatorname.iscsi}} in the acl configuration.
+
At the server (target) you might need to include the client iqn from {{ic|/etc/iscsi/initiatorname.iscsi}} in the acl configuration.
  
After both steps are finished you should be able to start the initiator with {{Cli|# /etc/rc.d/open-iscsi start}}.
+
After both steps are finished you should be able to start the initiator with {{bc|# systemctl enable open-iscsi.service
You can see the current sessions with {{Cli|# /etc/rc.d/open-iscsi status}}.
+
# systemctl start open-iscsi.service}}
You might want to include {{Codeline|open-iscsi}} in your [[rc.conf#Daemons]].
+
You can see the current sessions with {{bc|# systemctl status open-iscsi.service}}
  
 
== Using the Tools ==
 
== Using the Tools ==
{{Codeline|iscsid}} has  to be running.
+
{{ic|iscsid}} has  to be running.
  
 
=== Target discovery ===
 
=== Target discovery ===
{{Cli|# iscsiadm -m discovery -t sendtargets -p <portalip>}}
+
{{bc|# iscsiadm -m discovery -t sendtargets -p <portalip>}}
 
=== Delete obsolete targets ===
 
=== Delete obsolete targets ===
{{Cli|# iscsiadm -m discovery -p <portalip> -o delete}}
+
{{bc|# iscsiadm -m discovery -p <portalip> -o delete}}
  
 
=== Login to available targets ===
 
=== Login to available targets ===
{{Cli|# iscsiadm -m node -L all}}
+
{{bc|# iscsiadm -m node -L all}}
 
or login to specific target
 
or login to specific target
{{Cli|<nowiki># iscsiadm -m node --targetname=<targetname> --login</nowiki>}}
+
{{bc|<nowiki># iscsiadm -m node --targetname=<targetname> --login</nowiki>}}
  
 
logout:
 
logout:
{{Cli|# iscsiadm -m node -U all}}
+
{{bc|# iscsiadm -m node -U all}}
  
 
=== Info ===
 
=== Info ===
 
For running session
 
For running session
{{Cli|# iscsiadm -m session -P 3}}
+
{{bc|# iscsiadm -m session -P 3}}
 +
The last line of the above command will show the name of the attached dev e.g
 +
{{bc|Attached scsi disk '''sdd''' State: running}}
 +
 
 
For the known nodes
 
For the known nodes
{{Cli|# iscsiadm -m node}}
+
{{bc|# iscsiadm -m node}}
  
 
=== Online resize of volumes ===
 
=== Online resize of volumes ===
 
If the iscsi blockdevice contains a partitiontable, you will not be able to do an online resize. In this case you have to unmount the filesystem and alter the size of the affected partition.
 
If the iscsi blockdevice contains a partitiontable, you will not be able to do an online resize. In this case you have to unmount the filesystem and alter the size of the affected partition.
# Rescan active nodes in current session {{Cli|# iscsiadm -m node -R}}
+
# Rescan active nodes in current session {{bc|# iscsiadm -m node -R}}
# If you use multipath, you also have to rescan multipath volume information. {{Cli|# multipathd -k"resize map sdx"}}
+
# If you use multipath, you also have to rescan multipath volume information. {{bc|# multipathd -k"resize map sdx"}}
# Finally resize the filesystem. {{Cli|# resize2fs /dev/sdx}}
+
# Finally resize the filesystem. {{bc|# resize2fs /dev/sdx}}
  
 
== Tips ==
 
== Tips ==
You can also check where the attached iSCSI devices are located in the /dev tree with {{Codeline|ls -lh /dev/disk/by-path/* | grep ip}}.
+
You can also check where the attached iSCSI devices are located in the /dev tree with {{ic|ls -lh /dev/disk/by-path/* | grep ip}}.
  
 
== See also ==
 
== See also ==
 
* [[iSCSI Boot]] Booting Arch Linux with / on an iSCSI target.
 
* [[iSCSI Boot]] Booting Arch Linux with / on an iSCSI target.
 
[[Category:Storage (English)]]
 
[[Category:Networking (English)]]
 

Revision as of 00:33, 30 July 2013

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary heading Template:Article summary wiki Template:Article summary end

With Wikipedia:iSCSI you can access storage over an IP-based network.

The exported storage entity is the target and the importing entity is the initiator.

The preferred initiator is Open-iSCSI as of 2011. An older initiator, Linux-iSCSI, was merged with Open-iSCSI. Linux-iSCSI should not be confused with linux-iscsi.org, the website for the LIO target.

Setup With Open-iSCSI

Even open-iscsiAUR is not in the official repositories, so you need to build it from AUR.

Using the Daemon

You only have to include the IP of the target as SERVER in /etc/conf.d/open-iscsi at the client.

At the server (target) you might need to include the client iqn from /etc/iscsi/initiatorname.iscsi in the acl configuration.

After both steps are finished you should be able to start the initiator with
# systemctl enable open-iscsi.service
# systemctl start open-iscsi.service
You can see the current sessions with
# systemctl status open-iscsi.service

Using the Tools

iscsid has to be running.

Target discovery

# iscsiadm -m discovery -t sendtargets -p <portalip>

Delete obsolete targets

# iscsiadm -m discovery -p <portalip> -o delete

Login to available targets

# iscsiadm -m node -L all

or login to specific target

# iscsiadm -m node --targetname=<targetname> --login

logout:

# iscsiadm -m node -U all

Info

For running session

# iscsiadm -m session -P 3

The last line of the above command will show the name of the attached dev e.g

Attached scsi disk sdd State: running

For the known nodes

# iscsiadm -m node

Online resize of volumes

If the iscsi blockdevice contains a partitiontable, you will not be able to do an online resize. In this case you have to unmount the filesystem and alter the size of the affected partition.

  1. Rescan active nodes in current session
    # iscsiadm -m node -R
  2. If you use multipath, you also have to rescan multipath volume information.
    # multipathd -k"resize map sdx"
  3. Finally resize the filesystem.
    # resize2fs /dev/sdx

Tips

You can also check where the attached iSCSI devices are located in the /dev tree with ls -lh /dev/disk/by-path/* .

See also

  • iSCSI Boot Booting Arch Linux with / on an iSCSI target.