Sie sind auf Seite 1von 5

##install scsi-target-utils ##step 1 ##create iscsi target [root@red6 ~]# tgtadm --lld iscsi --op new --mode target

--tid 1 -T iqn.2012-03: vjti ##step 2 ##display and verify created target ##target id :1 ##disk name : vjti [root@red6 ~]# tgtadm --lld iscsi --op show --mode target Target 1: iqn.2012-03:vjti System information: Driver: iscsi State: ready I_T nexus information: LUN information: LUN: 0 Type: controller SCSI ID: IET 00010000 SCSI SN: beaf10 Size: 0 MB Online: Yes Removable media: No Backing store type: rdwr Backing store path: None Account information: ACL information: ##Step 3 ##add logical unit (LUN) to the target ## "-b" : backing store (removable media) [root@red6 ~]# tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/sdb ##step 4 ## display created LUN ## add logical unit 1 to the target 1 i.e. disk /dev/sdb ##lun0 is reserved for a special device automatically created. [root@red6 ~]# tgtadm --lld iscsi --op show --mode target Target 1: iqn.2012-03:vjti System information: Driver: iscsi State: ready I_T nexus information: LUN information: LUN: 0 Type: controller SCSI ID: IET 00010000 SCSI SN: beaf10 Size: 0 MB Online: Yes Removable media: No Backing store type: rdwr Backing store path: None

LUN: 1 Type: disk SCSI ID: IET 00010001 SCSI SN: beaf11 Size: 2147 MB Online: Yes Removable media: No Backing store type: rdwr Backing store path: /dev/sdb Account information: ACL information: ##step 5 ## add the address to the access list of the target id : 1 ## assigning permission to use the target by all initiators ## replace "ALL" by specific IP address to limit initiators [root@red6 ~]# tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL ################################################################################ ###### ################################################################################ ######## ################################################################################ ######## ################################################################################ ######## ############ INITIATOR SEQUENCE ################ ##install iscsi-initiator-utils ##step 1 : ##start iscsi deamon [root@red2 ~]#service iscsi start ##step 2 : ## discover iscsi target at server IP 192.168.0.11 ## discovery mode : discovery of iscsi target server ## sendtarget : get info about target at portal IP [root@red2 ~]#iscsiadm --mode discovery --type sendtargets --portal 192.168.0.11 192.168.0.11:3260,1 iqn.2012-03:vjti ##step 3 ##loggin in to the target [root@red2 ~]#iscsiadm --mode node --targetname iqn.2012-03:vjti --portal 192.16 8.0.11 --login Logging into [iface:default, target:iqn.2012-03:vjti, portal 192.168.0.11,3260] Login in [iface:default, target:iqn.2012-03:vjti, portal 192.168.0.11,3260] succ essful ##step 4

## verify successful login ## /dev/sdb disk seen at client [root@red2 ~]#tail -f /var/log/message Mar 31 15:26:41 red2 kernel: scsi 3:0:0:0: Attached scsi generic sg2 type 12 Mar 31 15:26:41 red2 kernel: scsi 3:0:0:1: Direct-Access IET VIRTUAL-DI SK 0001 PQ: 0 ANSI: 5 Mar 31 15:26:41 red2 kernel: sd 3:0:0:1: Attached scsi generic sg3 type 0 Mar 31 15:26:41 red2 kernel: sd 3:0:0:1: [sdb] 4194304 512-byte logical blocks: (2.14 GB/2.00 GiB) Mar 31 15:26:41 red2 kernel: sd 3:0:0:1: [sdb] Write Protect is off Mar 31 15:26:41 red2 kernel: sd 3:0:0:1: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA Mar 31 15:26:41 red2 kernel: sdb: unknown partition table Mar 31 15:26:41 red2 kernel: sd 3:0:0:1: [sdb] Attached SCSI disk Mar 31 15:26:42 red2 iscsid: Could not set session1 priority. READ/WRITE through out and latency could be affected. Mar 31 15:26:42 red2 iscsid: Connection1:0 to [target: iqn.2012-03:vjti, portal: 192.168.0.11,3260] through [iface: default] is operational now ##step 5 ##restart iscsi service to probe partitions ##check partition table [root@red2 ~]#partprobe /dev/sdb [root@red2 ~]#fdisk -l /dev/sdb Disk /dev/sdb: 2147 MB, 2147483648 bytes 67 heads, 62 sectors/track, 1009 cylinders Units = cylinders of 4154 * 512 = 2126848 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/sdb doesn't contain a valid partition table ##step 6 ##partitioning the iscsi hard disk through initiator/client ##-create logical partition in iscsi target 500MB ##-create logical partition in iscsi target 500MB ##-write changes to disk [root@red2 ~]#fdisk /dev/sdb Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-1009, default 1): Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-1009, default 1009): 500 Command (m for help): n Command action e extended p primary partition (1-4)

p Partition number (1-4): 2 First cylinder (501-1009, default 501): Using default value 501 Last cylinder, +cylinders or +size{K,M,G} (501-1009, default 1009): Using default value 1009 Command (m for help): p Disk /dev/sdb: 2147 MB, 2147483648 bytes 67 heads, 62 sectors/track, 1009 cylinders Units = cylinders of 4154 * 512 = 2126848 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x993117b3 Device Boot /dev/sdb1 /dev/sdb2 Start 1 501 End 500 1009 Blocks 1038469 1057193 Id System 83 Linux 83 Linux

Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. ##step 7 ##creating file system in iscsi target partition ## [root@red2 Desktop]# mkfs.ext3 /dev/sdb1 mke2fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 65024 inodes, 259617 blocks 12980 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=268435456 8 block groups 32768 blocks per group, 32768 fragments per group 8128 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376 Writing inode tables: done Creating journal (4096 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 22 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. [root@red2 Desktop]# mkfs.ext3 /dev/sdb2 mke2fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks

66096 inodes, 264298 blocks 13214 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=272629760 9 block groups 32768 blocks per group, 32768 fragments per group 7344 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376 Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 38 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.

Das könnte Ihnen auch gefallen