- Create an iSCSI target (server) on fedora 9)
- ISCSI initiator (client) operations in Ubuntu 8.10 Systems
- Iscsi target permission settings
- ISCSI initiator: automatically activates an ephemeral iSCSI hard drive on Ubuntu.
- Appendix: WINXP iSCSI software initiator operation forgets
Create an iSCSI target (server)
Environment:
- Fedora 9 x86_64
- Hostname: Example
- IP Address: 192.168.1.1
Yum install SCSI-target-utils
Chkconfig tgtd on
/Etc/init. d/tgtd start
Create a 10 Gb elastic volume, but do not allocate a real blank space
Dd If =/dev/Zero of =/test. img bs = 1 seek = 10g COUNT = 0
Set the 10 Gb quota disk space created by zookeeper to the iSCSI target test.
TGT-setup-lun-D/test. IMG-n test
Another design cube method (Regulation)
Tgtadm -- Mode target -- op new -- TID 1-T iqn.2009-04.com. Example-test
Tgtadm -- Mode logicalunit -- op new -- TID 1 -- Lun 1-B/test. img
Tgtadm -- Mode target -- op bind -- TID 1-I all
Ref: Maarten Lippmann-dd examples
,
/Usr/share/doc/scsi-target-utils-0.0 /*
PS. If you want to enable auto-production of iSCSI target, move TGT-setup-lun or tgtadm into Rc. Local.
ISCSI initiator (client) basic operations
Environment:
- Ubuntu 8.10
- Open-iSCSI 2.0-870.3 (source installation)
Server guard open-iSCSI suite
Download open-iSCSI tar-ball source from
Official site
Sudo Su-
CD/path/to/Open-iSCSI-Src
Make ksrc =/usr/src/Linux-headers-$ (uname-R)
Make install
Zookeeper iSCSI hard drive
/Etc/init. d/Open-iSCSI start
Iscsiadm-M discovery-T sendtargets-P 192.168.1.1
List all targets
Iscsiadm-M Node
Log on to all targets
Iscsiadm-M node-l all
Log on to the specified target
Iscsiadm-M node-T iqn.2001-04.com. Example-test-P 192.168.1.1
-- Login
View the current iSCSI target has been released successfully
Iscsiadm-M session
TCP: [1] 192.168.1.1: 3260, 1 iqn.2001-04.com. Example-test
View hard drive replacement
Dmesg | tail
The first ephemeral disk created using dd must be formatted.
Fdisk/dev/SDB
Mke2fs-J/dev/sdb1
Mount/dev/sdb1/mnt
Detach an iSCSI Hard Disk
Umount/mnt
Log out all targets
Iscsiadm-M node-u all
Log out of the specified target
Iscsiadm-M node-T iqn.2001-04.com. Example-test-P 192.168.1.1
-- Logout
View the currently available regions and zones
Iscsiadm-M session
Iscsiadm: no active sessions.
Iscsi target)
Remove all node resources (New Discovery required)
Iscsiadm-M node -- op Delete
Iscsi target permission settings
Using CHAP authentication Authentication
Create a secret
Tgtadm -- Mode account -- op new -- user test -- password your_secret
Specify target information
Tgtadm -- Mode target -- op show
Target 1:
Iqn.2001-04.com. Example-test (Target 1 = -- tid
1)
System Information:
Driver: iSCSI
State: Ready
I _t nexus information:
Lun information:
Lun: 0
Type:
Controller
...
Lun: 1 (Lun 1 = -- Lun 1, disk starts from 1)
Type: Disk
...
Backing
Store:/path/to/disk. img
Account Information:
ACL information:
All
Specify the login commit (* commit) of Target 1)
Tgtadm -- Mode account -- op bind -- TID 1 -- user test
* Labels:
Scsi-target-utils-0.0-5.20080805snap.fc9.x86_64, scsi-target-utils-0.0-6.20080805snap.fc10.i386
The final result is that the initiator can use any of the regions created by tgtadm to generate login regardless of the target bind.
Set ACL Information
Only the lan ip Address can use target 1 (the last region is large I)
Tgtadm -- Mode target -- op bind -- TID 1-I 192.168.1.0/24
Unbind existing ACL Information
Tgtadm -- Mode target -- op unbind -- TID 1-I all
ISCSI initiator: automatically activates an ephemeral iSCSI hard drive on Ubuntu.
Sudo Su-
Apt-Get install sysv-RC-Conf
Sysv-RC-conf open-iSCSI
Sysv-RC-conf -- level 2 Open-iSCSI on
VI/etc/iSCSI/iscsid. conf
Node. startup = automatic
# Node. startup = manual
If target has chap Auth:
Node. session. Auth. authmethod = chap
Node. session. Auth. Username = Username
Node. session. Auth. Password = Password
VI/etc/fstab
/Dev/sdb1/mnt ext3
Defaults, noatime 0 0
/Etc/init. d/Open-iSCSI start
Iscsiadm-M discovery-T sendtargets-P 192.168.1.1
Iscsiadm-M node-l all
/Etc/init. d/Open-iSCSI restart
PS. Remove service: update-rc.d-f Open-iSCSI remove
Appendix: WINXP iSCSI software initiator operation forgets
(ISCSI software initiator has been created in both Vista and Windows 7)
Installing Microsoft iSCSI software Initiator
Microsoft iSCSI initiator on the desktop (or console) of the primary row
Discovery → add → IP address or DNS name: 192.168.1.1 → OK
Targets → select target> log on...
If the target does not have chap auth, click OK.
Set chap: Advanced... → check chap logon information
User name: Username
Target secret: Password (the password must be 12 ~ 16 characters)
Confirm → OK
Desktop → my computer (right) → Management (or console "System Management Tools" → "Computer Management ")
Disk management → → Disk 1 (unknown) not initialized (right margin) → disk Initialization
After Disk 1 is initialized, Disk 1 Changes to "Basic" and "portable". In the "not configured" area on the right hand side, press "right, click "add disk partition" to configure hard disk space