⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme

📁 一个iSCSI协议实现源代码
💻
字号:
The drivers included here are an initial implementation of iSCSI for linux.This is a quick HOWTO on how to get iSCSI up and running in your environment.Getting StartedTo use these modules you need to have 2 machines running linux 2.4.x connectedtogether via some TCP/IP network.  (using 1 machine and running both the targetand client on localhost probably works but is untested).1 machine should have a SCSI adapter installed with a SCSI device (disk)preferably using SCSI Id 0.  This machine is henceforth referred to as the"target" machine.  The other machine is henceforth reffered to as the "client"machine.*DO NOT USE A TARGET SCSI DEVICE CONTAINING IMPORTANT DATA*You have been warned.Installing-- Client Side --On the client machine download the initiator source distribution from here:http://www.cs.uml.edu/~mbrown/iSCSI/iscsi-0.1.tar.gzMake sure /usr/src/linux contains the source to your running kernel and isversion 2.4.x.  Extract the sources:   $ tar -zxvf iscsi-0.1.tar.gz   $ cd iscsiEdit the file iscsi_client.c.  Change line 488 to:        u32 addr = <target_ip_address>;where target_ip_address is the IP address of your target machine inhex format in network byte ordering.  There are some examples includedthere to help.  Build the iscsi and iscsi_client kernel modules:   $ make-- Target Side -- On the target machine download the target source distribution from here:ftp://ftp.iol.unh.edu/pub/iscsi/kernel_emulator_10.tgzLike the client, make sure /usr/src/linux contains the source to your running kernel and is version 2.4.x.  Extract the sources:   $ tar -zxvf kernel_emulator_10.tgz   $ cd kernel_emulator_10Edit the file scsi_target.h.  Comment line 47://# define MEMORYIOUncomment line 49:#define FILEIOFor an explanation of what these modes of operations do, read Ashish Palekar'spaper included with the distribution (tr0101.pdf).  Currently the clientdistribution works with either MEMORYIO or FILEIO.  (Ashish has saidGENERICIO mode works, I have been unable to get it working.  This is sillbeing investigated)Build the iscsi_target and scsi_target kernel modules:   $ makeNote this distribution also includes a qlogicfc driver and an sep_targetdriver.  These are not needed for our purposes.Optionally instead of using the kernel target, you may use the user spacetarget provided with the client distribution.  This is currentlyundocumented but should be straightforward to use.  It is intended to simplify debugging the client for those wishing to hack my client code.-- Kernel Configuration --On both machines make sure your kernel has compiled in support or modules for scsi, sg, and sd.  (st and sr too if the device you want to use over iscsi is a cdrom or tape).  On the target machine make sure you have compiled insupport or modules for your scsi adapter.-- Running --Before executing these insmod lines make sure your have the appropriatescsi modules loaded if necesary.  The target modules when running in FILEIOmode open up two files scsi_disk_file_0_0 and scsi_disk_file_0_1 in the currentdirectory.  It uses these files as virtual disks.  Before loading the target kernel modules, on the target machine create a symbolic link fromyour scsi device to scsi_disk_file_0_0:(in my case, I have a 520MB scsi disk attached to the only scsi adapter in the machine)   $ ln -s /dev/sda scsi_disk_file_0_01.  On the target, execute:   $ insmod ./scsi_target.o   $ insmod ./iscsi_target.o2.  On the client, execute:   $ insmod ./iscsi.o   $ insmod ./iscsi_client.oNote the target should be up and running before the client modules are loaded,otherwise the client will cause a kernel panic() due to a bug in my code.Also note that rmmod'ing the iscsi_client module will cause a panic() dueto a bug in my code.  Suggest rebooting the client for each new instantiation.-- Using iSCSI --All commands henceforth are to be executed on the client.  No furtherwork is required on the target.Assuming that my directions were accurate and everything went ok, by this point you should have a working iSCSI connection.  To verify, machine execute:   $ lsmodand verify iscsi and iscsi_client are loaded.   $ cat /proc/scsi/scsiand verify you see a listing similar to:Attached devices: Host: scsi0 Channel: 00 Id: 00 Lun: 00  Vendor: UNH-IOL  Model: Target Emulator  Rev: 1.1   Type:   Direct-Access                    ANSI SCSI revision: 01....   $ cat /proc/scsi/iscsi_client/0and verify you see a message similar to:This driver implements the IETF iSCSI draft (SCSI over TCP/IP)At this point hopefully you've verified that your iSCSI setup is up and running.  If there are no other SCSI adapters on your system, the first device available should be /dev/sda.  You may now use /dev/sda on the client likeany other SCSI disk as if it were local to the client.  Examples include:   ( to view/modify the partition table )   $ fdisk /dev/sda   ( to create an ext2 filesystem on the first partition )   $ mke2fs /dev/sda1   ( to mount the iscsi partition )   $ cd /mnt   $ mkdir iscsi   $ mount /dev/sda1 /mnt/iscsi -t ext2   ( to copy files to and from the mounted iscsi partition )   $ cp /etc/passwd /mnt/iscsi/   $ cp /boot/vmlinuz-2.4.3 /mnt/iscsi/   $ cp /mnt/iscsi/passwd /tmp/passwd   $ cp /mnt/iscsi/vmlinuz-2.4.3 /tmp/vmlinuz-2.4.3   ( to verify the integrity of the files copied to and from the iscsi     partition )   $ diff /tmp/passwd /etc/passwd   $ diff /tmp/vmlinuz-2.4.3 /boot/vmlinuz-2.4.3-- Final Notes --When you are done playing with the iscsi mount you should unmount per usual via:      $ umount /mnt/iscsiIn addition, since the client's kernel thinks its the only entity to everaccess that scsi disk it may have buffered mount state.  You should run:   $ syncto force the client to flush any and all outstanding kernel buffers.Performance is abysmal in my setup, 10 Mbit eth network. 100K/s according to hdparm.  I have a number of theories I am investigating.-- Problems/Questions/Flames --Any problems you encounter specifically with the client setup should bedirected to me, Michael F. Brown, mbrown@cs.uml.edu.  Feel free to alsocontact me with help with the target setup.  If I can't answer your questionsabout the target, I will forward them to Ashish Palekar, the author of thetarget drivers.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -