发新话题
打印

A Quick Guide to iSCSI on Linux

A Quick Guide to iSCSI on Linux

A Quick Guide to iSCSI on Linux
Cuddletech TekRef Series
Ben RockwoodCuddletech
<benr@cuddletech.com>




Revision HistoryRevision v1.0April 11th 2004benrInitial DocumentRevision v1.1April 12th 2004benrClarifications and Cisco Ref addedRevision v1.2April 23th 2004benrFixes, Typos, and Various AdditionsRevision v1.3June 7th 2004benrAdded Solaris procedureRevision v1.4Aug 6th 2004benrAdded sidebar for IET, ardis to be removed soon

Abstract
A quick and gentle overview of iSCSI on Linux. Setting up both an iSCSI initiator and iSCSI target on a Linux system are covered with a quick overview of essential iSCSI terms and ideas. This paper is also avalible as a PDF.




Table of Contents
Introduction The Basics Setting up a Target Setting up an Initiator Accessing iSCSI Targets from non-Linux Hosts Using Volumes as iSCSI Targets Cisco iSCSI Initiator Command Reference Resources and Further Reading
Introduction



More and more it appears that iSCSI isn't going away, but might just be here to stay for awhile. In a nutshell, iSCSI is simply the pairing of the "best" of both NAS (using NFS or CIFSs over IP Ethernet networks) and SAN (Fibre Channel Fabrics) technologies. What you ultimately get is a protocol that allows you to use SCSI commands like Fibre Channels FCP, yet does it over an IP network instead of a costly Fibre Channel Fabric. Instead of buying an expensive Brocade or McData switch and costly Fibre Channel HBAs from companies like JNI, Adaptec and Emulex, you can use any IP switch (NetGear, 3Com, Extreme, Foundry, etc) and normal Ethernet cards. Because SCSI is CPU intensive during high I/O loads iSCSI Host Bus Adapters (HBA) have arrived which act just like a FC HBA except that it uses Ethernet instead of FC Fabric; the idea being that the SCSI requests are offloaded from your primary CPU onto the ASIC on your iSCSI HBA.
SCSI uses a client-server architecture. A "client" (ie: your system) is an initiator, it initiates requests. A "server" (ie: your storage device) is a target, it has something you want and answers requests from the initiator(s). Initiators come in two varieties: software and hardware. A software initiator is just a driver that handles all requests and pairs the network interfaces driver and the SCSI drivers together to make it all work. Using a software initiator any system with an ethernet card can act as an iSCSI initiator. A hardware initiator is an iSCSI HBA, which is basically just an ethernet card with a SCSI ASIC on-board to offload all the work from the system CPU. Because there is no cost involved in using a software initiator we'll look at that. Adaptec is currently selling iSCSI HBA's which have Linux drivers available if you choose to go that route.
There are three very interesting projects in the Linux community regarding iSCSI at the moment. The first is a project from the University of New Hampshire's Inter-op Labs (legendary in Fibre Channel circles). Their iSCSI implementation provides both software initiator and target code for use with a Linux kernel. While it's an interesting project, they admit that their target code is really only around for testing their initiator code, and documentation and tools for the UNH iSCSI code is confusing. Even when you get UNH iSCSI running it's unclear what it's doing and how. So we look at 2 other projects which complement each other: The Linux iSCSI Target Implementation from Ardis Technologies and the Linux-iSCSI Project (software initiator). We will look at these 2 projects for testing and playing with iSCSI.


TOP

The Basics


Before we actually build anything, you need to understand a couple things. Lets look at how iSCSI addresses are formed and how iSCSI is used, some general terms, and overall methodology.
It's important to understand that iSCSI, unlike NAS, makes block devices available via the network. Effectively, you can mount block devices (disks) across an IP network to your local system and then use them like any other block device. Generally when you first use an iSCSI device your going to need to partition it, label it, and create a filesystem on it. Unlike NAS your kernel will be able to read and write to your new iSCSI device just as if it were a local hard disk and therefore you can use any filesystem you like (EXT2/3, JFS, XFS, ReiserFS, etc). Also, because it is being handled as a block device only one (1) system can use the iSCSI device at a time! (This changes if you use a global filesystem, or read-only filesystem.) So just like Fibre Channel your not making 4 machines access 1 filesystem, but instead your allocating 4 chunks of disk on one large device and making it avalible via an iSCSI target so that 4 initiators can access it.
All devices in an iSCSI enviroment will have addresses. Think of addresses in iSCSI as being the iSCSI equivelent to a Fibre Channel WWN. Every address must be unique. Initiators will have addresses, and targets will have addresses. When you define a target you can specify the address yourself. When you use an initiator the address is typically defined for you. For instance, on my test setup used for this tutorial I have the following addresses:
On Nexus, Linux System:iqn.1987-05.com.cisco:01.54197b8f9a8        -> Linux Initiator Addressiqn.1997-06.com.homestead:storage.disk1.nexus -> iSCSI Target Disk on Nexusiqn.1997-06.com.homestead:storage.disk2.drew -> iSCSI Target Disk for Drewiqn.1997-06.com.homestead:storage.raid.stripe0 -> iSCSI Target RAID On Blade, Solaris System:iqn.1987-05.com.cisco:01.f554845210af        -> Solaris Initiator AddressiSCSI uses the following form for addresses, as found documented in IETF iSCSI Protocol Draft 20.
iSCSI Address Form:        The following are examples of iSCSI qualified names that might be   generated by "EXAMPLE Storage Arrays, Inc."                     Naming     String defined by        Type  Date    Auth      "example.com" naming authority       +--++-----+ +---------+ +--------------------------------+       |  ||     | |         | |                                |       iqn.2001-04.com.example:storage:diskarrays-sn-a8675309       iqn.2001-04.com.example       iqn.2001-04.com.example:storage.tape1.sys1.xyz       iqn.2001-04.com.example:storage.disk2.sys1.xyzIn the above examples, you can see the form. There are two different address types, iqn (iSCSI Qualified Name) and eui (IEEE EUI-64 format). The date field is the date of the first full month that your naming authorities domain name was registered. The Naming Auth is the naming authority (domain name) for this target, reversed. Following the naming authority is a colon, after which you can put anything you want to help you better organize your resourced. In the example above (#2) this field is left off completely which is legal. In examples 1 and 3 above you can see different naming conventions being used to clarify the target resources type. But in both cases the date and naming authority are the same. Cuddletech was registered on Jan 30th, 1999, so if I shared a 20G target I might use the target address: "iqn.1999-02.com.cuddletech:public.dump.20g-Seagate.jfs". So far I have not seen an implementation that actually used the naming authority for resolution, so it doesn't really matter what the naming authority is. Most Cisco targets and initiators will get the naming authority of cisco.com, and thats not a problem. You'll almost always be asked for the IP address of the iSCSI target, so feel free to name your targets anything you want so long as it follows the convension above.
Some other terms you may want to know include "portals" and "discovery". An iSCSI portal is a targets IP and TCP port number pair. Typically, if the port number is not specified it is defaulted to 3260. Discovery, or auto-discovery, is the proccess of an initiator asking a target portal for a list of it's targets and thus making those available to the initator for use. Most of the time using discovery on a target portal is the best way to get connected, and you'll see this done when we setup an initiator later. You can, however, alternately specify specifically the portal and target you wish to use. You can also use iSNS (the Internet Storage Name Service) for discovery instead of contacting a specific portal. iSNS is effectively like DNS for network storage devices. Finally, one kool thing you can do, especially if your using iSCSI as a method to extend your FC-SAN, is to allow multi-pathing for fault-tolerance. In such as case, a storage device would be avalible as a target on 2 or more target portals (or specified as such in your iSNS directory) and if one server died, you could continue to access the device thru the other portals. But doing such is beyond the scope of this tutorial.


TOP


TOP

里面还有更多的内容,请需要的朋友自己找一下吧


TOP

发新话题