In Ubuntu, the initiator is openiscsi, which is convenient and easy to use. The following describes how to use it: 1. install: sudoapt-getinstallopen-iscsi2.chap settings if chap is set on ip-san (skip this step if chap is not set), modify/etc/iscsi/iscsid. conf, find the following content, remove the previous #, and change the username and password to san.
In Ubuntu, the initiator is open iscsi, which is convenient and easy to use. The following describes how to use it:
1. installation:
Sudo apt-get install open-iscsi
2. chap settings
If chap is set on ip-san (chap is not set, skip this step), modify/etc/iscsi/iscsid. conf, find the following content, remove the previous #, and change the username and password to the password set on san.
Node. session. auth. authmethod = CHAP
Node. session. auth. username = username
Node. session. auth. password = password
3. Search for the target in the LAN:
Iscsiadm-m discovery-t sendtargets-p 10.8.12.31: 3260
10.8.12.31 is the target ip address, and 3260 is the iscsi service port. After executing the command, you can see the following content:
10.8.12.31: 3260,1Iqn.2010-06. iscsiraid: raid-2718000358: default-target
That is, the target and its iqn are found. Note that only the red part is iqn.
In addition, you can use
Iscsiadm-m node
To view the iqn of the target.
4. view the iqn of the initiator:
Enter cat/etc/iscsi/initiatorname. iscsi | grep InitiatorName in the terminal
The following information is usually displayed:
InitiatorName = iqn.1993-08.org. debian: 01: 54df13fa873e
You can see the iqn corresponding to the local machine. When creating a lun for some disk arrays, you must enter the iqn of the initiator.
5. log on to target:
After finding the iqn of target, we can log on and run
Iscsiadm-m node -- targetnameIqn.2010-06. iscsraid: raid-2718000358: default-target-- Login
After execution, you can see the result:
Logging in to [iface: default, target: iqn.2010-06. iscsiraid: raid-2718000358: default-target, portal: 10.8.12.31, 3260]
At this time, run in another terminal
Dmesg | tail
You can see that
[28387.007043] sd 4: 0: 0: 0: [sdb] Attached SCSI disk
[28387.020253] sd 4: 0: 0: 1: [sdc] Attached SCSI disk
[28387.027187] sd 4: 0: 0: 2: [sdd] Attached SCSI disk
[28387.033962] sd 4: 0: 0: 3: [sde] Attached SCSI disk
The mounting is successful.
Next, you can use
Fdisk/dev/sdb
Mkfs. ext3/dev/sdb
Partition and format the disk
Then, you can execute
Hdparm-tT/dev/sdb
To test the san I/O speed. The results are as follows:
/Dev/sdb:
Timing cached reads: 1814 MB in 2.00 seconds = 906.39 MB/sec
Timing buffered disk reads: 34 MB in 3.08 seconds = 11.03 MB/sec
Another problem is that information about disks mounted through iscsi is lost every time you restart the computer. Therefore, you need to add a script to/etc/init. d/to remount the disk array.
6. log out of target
Iscsiadm-m node -- targetnameIqn.2010-06. iscsraid: raid-2718000358: default-target-- Logout
7. Delete target
Iscsiadm-m node -- op delete -- targetnameIqn.2010-06. iscsraid: raid-2718000358: default-target
An error may be reported:
Iscsiadm: This command will remove the record [iface: default, target: iqn.2010-06. iscsiraid: raid-2718000358: default-target, portal: 192.168.100.140, 3260], but a session is using it. logout session then rerun command to remove record.
Iscsiadm: cocould not execute operation on all records. Err 22.
Run
/Etc/init. d/open-iscsi restart
Restart the open-iscsi service and run fdisk-l to check that all the attached iscsi disks have been detached.