How you configure Iscsi target using starwind free Nas software & configure Iscsi initiator on Oracle Linux 6.4 Download the software from http://www.starwindsoftware.com/ Click on products then under Free products click on Starwind iscsi SAN Free Edition You will need to register to get the free serial key for the product. After installing the software Double click the icon on the desktop Starwind Management console Follow the below screenshot for step by setup instruction to configure Iscsi target I am using version 6.0 as per the screen shot above the status is Not logged in
Under Starwind Servers right click on the computer name show and click on connect Now the status is connected. We will configure a single target with 2 disk drive.
Under hostname right click on Targets and click on Add target Provide the Target Alias as I have given test1 then click on the check box allow multiple concurrent iscsi connections (Clustering) then click on next
If you want to make any changes you can click on back or you can click on next to continue. Now click on Finish
On the right had side under target list you can see our target test1 is added right click on test1 and click on add a new device to the target Click on Virtual Hard Disk and click on Next
Click on Image File Device and click on Next Click on create new virtual disk and click on Next
Input the disk name, required size and click on the browse button to save the disk image to the required folder (Please note the disk will be saved as a virtual disk file on the existing physical hard disk) Click on next
Keep the values default and click on next If you want to make any changes you can click back and edit the required details or click on next
Click on Finish Repeat the step to add one more device (Disk drive) You can see below under Devices if the virtual hard disk is added
As you can see I have added 2 disk of 1GB each on my target test1 Now log in to the Linux server where you need this two hard disk to be used as storage # my current hard disk partition [root@server2 ~]# fdisk -l Disk /dev/sda: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Disk identifier: 0x00003bdc Device Boot Start End Blocks Id System /dev/sda1 * 1 64 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 64 2611 20458496 8e Linux LVM Disk /dev/sdb: 5368 MB, 5368709120 bytes 255 heads, 63 sectors/track, 652 cylinders Disk identifier: 0xa104481e
Device Boot Start End Blocks Id System /dev/sdb1 1 652 5237158+ 8e Linux LVM Disk /dev/sdc: 5368 MB, 5368709120 bytes 255 heads, 63 sectors/track, 652 cylinders Disk identifier: 0xc9e6274b Device Boot Start End Blocks Id System /dev/sdc1 1 652 5237158+ 8e Linux LVM Disk /dev/sdd: 5368 MB, 5368709120 bytes 255 heads, 63 sectors/track, 652 cylinders Disk identifier: 0xffb99b56 Device Boot Start End Blocks Id System /dev/sdd1 1 652 5237158+ 8e Linux LVM Disk /dev/mapper/vg01-logvol01: 16.7 GB, 16651386880 bytes 255 heads, 63 sectors/track, 2024 cylinders Disk identifier: 0x00000000 Disk /dev/mapper/vg01-logvol00: 4294 MB, 4294967296 bytes 255 heads, 63 sectors/track, 522 cylinders Disk identifier: 0x00000000 Disk /dev/mapper/vg02-logvol00: 4294 MB, 4294967296 bytes 255 heads, 63 sectors/track, 522 cylinders Disk identifier: 0x00000000 [root@server2 ~]# ls -l /dev/sd?1 brw-rw----. 1 root disk 8, 1 Aug 28 17:26 /dev/sda1
brw-rw----. 1 root disk 8, 17 Aug 28 17:26 /dev/sdb1 brw-rw----. 1 root disk 8, 33 Aug 28 17:26 /dev/sdc1 brw-rw----. 1 root disk 8, 49 Aug 28 17:26 /dev/sdd1 # List the available iscsi package available from the yum repository [root@server2 ~]# yum list iscsi* Loaded plugins: refresh-packagekit, security Available Packages iscsi-initiator-utils.i686 ol6_latest iscsi-initiator-utils.x86_64 ol6_latest iscsi-initiator-utils-devel.i686 ol6_latest iscsi-initiator-utils-devel.x86_64 ol6_latest 6.2.0.873-2.0.2.el6 6.2.0.873-2.0.2.el6 6.2.0.873-2.0.2.el6 6.2.0.873-2.0.2.el6 # Install the iscsi package [root@server2 ~]# yum install iscsi* Loaded plugins: refresh-packagekit, security Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package iscsi-initiator-utils.x86_64 0:6.2.0.873-2.0.2.el6 will be installed ---> Package iscsi-initiator-utils-devel.x86_64 0:6.2.0.873-2.0.2.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ===================================================================================== ===================================================================================== Package Arch Version Repository Size ===================================================================================== ===================================================================================== ==================================== Installing: iscsi-initiator-utils x86_64 6.2.0.873-2.0.2.el6 ol6_latest 677 k iscsi-initiator-utils-devel x86_64 6.2.0.873-2.0.2.el6 ol6_latest 46 k Transaction Summary ===================================================================================== =====================================================================================
Install 2 Package(s) Total download size: 723 k Installed size: 2.5 M Is this ok [y/n]: y Downloading Packages: (1/2): iscsi-initiator-utils-6.2.0.873-2.0.2.el6.x86_64.rpm 677 kb 00:04 (2/2): iscsi-initiator-utils-devel-6.2.0.873-2.0.2.el6.x86_64.rpm 46 kb 00:00 ------------------------------------------------------------------------------------------------------------------------------------------ -------------------------------------------------------------------- Total 116 kb/s 723 kb 00:06 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : iscsi-initiator-utils-6.2.0.873-2.0.2.el6.x86_64 1/2 Installing : iscsi-initiator-utils-devel-6.2.0.873-2.0.2.el6.x86_64 2/2 Verifying : iscsi-initiator-utils-devel-6.2.0.873-2.0.2.el6.x86_64 1/2 Verifying : iscsi-initiator-utils-6.2.0.873-2.0.2.el6.x86_64 2/2 iscsi-initiator-utils- Installed: iscsi-initiator-utils.x86_64 0:6.2.0.873-2.0.2.el6 devel.x86_64 0:6.2.0.873-2.0.2.el6 Complete! # Start the Services [root@server2 ~]# service iscsi restart Stopping iscsi: [ OK ] [root@server2 ~]# service iscsid start [root@server2 ~]# chkconfig iscsid on [root@server2 ~]# chkconfig iscsi on # discover the iscsi targets the ip address given is my windows machine where I have install the starwind software and configured the target and disks. [root@server2 ~]# iscsiadm -m discovery -t st -p 192.168.1.1
192.168.1.1:3260,-1 iqn.2008-08.com.starwindsoftware:sunil-pc-test1 # Login to the iscsi targets [root@server2 ~]# iscsiadm -m node -l Logging in to [iface: default, target: iqn.2008-08.com.starwindsoftware:sunil-pc-test1, portal: 192.168.1.1,3260] (multiple) Login to [iface: default, target: iqn.2008-08.com.starwindsoftware:sunil-pc-test1, portal: 192.168.1.1,3260] successful. # check the mapping which iscsi lun is mapped to the physical disk [root@server2 ~]# cd /dev/disk/by-path/ [root@server2 by-path]# ls -ltr total 0 lrwxrwxrwx. 1 root root 9 Aug 28 17:26 pci-0000:00:10.0-scsi-0:0:2:0 ->../../sdc lrwxrwxrwx. 1 root root 9 Aug 28 17:26 pci-0000:00:10.0-scsi-0:0:1:0 ->../../sdb lrwxrwxrwx. 1 root root 9 Aug 28 17:26 pci-0000:00:10.0-scsi-0:0:3:0 ->../../sdd lrwxrwxrwx. 1 root root 10 Aug 28 17:26 pci-0000:00:10.0-scsi-0:0:2:0-part1 ->../../sdc1 lrwxrwxrwx. 1 root root 10 Aug 28 17:26 pci-0000:00:10.0-scsi-0:0:1:0-part1 ->../../sdb1 lrwxrwxrwx. 1 root root 10 Aug 28 17:26 pci-0000:00:10.0-scsi-0:0:3:0-part1 ->../../sdd1 lrwxrwxrwx. 1 root root 9 Aug 28 17:26 pci-0000:00:07.1-scsi-1:0:0:0 ->../../sr0 lrwxrwxrwx. 1 root root 9 Aug 28 17:26 pci-0000:00:10.0-scsi-0:0:0:0 ->../../sda lrwxrwxrwx. 1 root root 10 Aug 28 17:26 pci-0000:00:10.0-scsi-0:0:0:0-part2 ->../../sda2 lrwxrwxrwx. 1 root root 10 Aug 28 17:26 pci-0000:00:10.0-scsi-0:0:0:0-part1 ->../../sda1 lrwxrwxrwx. 1 root root 9 Aug 28 20:28 ip-192.168.1.1:3260-iscsi-iqn.2008-08.com.starwindsoftware:sunil-pc-test1-lun-1 ->../../sdf lrwxrwxrwx. 1 root root 9 Aug 28 20:28 ip-192.168.1.1:3260-iscsi-iqn.2008-08.com.starwindsoftware:sunil-pc-test1-lun-0 ->../../sde sdf and sde are the two new disk. # Automatic login to iscsi target during boot [root@server2 by-path]# iscsiadm -m node -T iqn.2008-08.com.starwindsoftware:sunil-pc-test1 -p 192.168.1.1 --op update -n node.startup -v automatic # check the disk using fdisk [root@server2 /]# fdisk -l Disk /dev/sda: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Disk identifier: 0x00003bdc
Device Boot Start End Blocks Id System /dev/sda1 * 1 64 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 64 2611 20458496 8e Linux LVM Disk /dev/sdb: 5368 MB, 5368709120 bytes 255 heads, 63 sectors/track, 652 cylinders Disk identifier: 0xa104481e Device Boot Start End Blocks Id System /dev/sdb1 1 652 5237158+ 8e Linux LVM Disk /dev/sdc: 5368 MB, 5368709120 bytes 255 heads, 63 sectors/track, 652 cylinders Disk identifier: 0xc9e6274b Device Boot Start End Blocks Id System /dev/sdc1 1 652 5237158+ 8e Linux LVM Disk /dev/sdd: 5368 MB, 5368709120 bytes 255 heads, 63 sectors/track, 652 cylinders Disk identifier: 0xffb99b56 Device Boot Start End Blocks Id System /dev/sdd1 1 652 5237158+ 8e Linux LVM Disk /dev/mapper/vg01-logvol01: 16.7 GB, 16651386880 bytes 255 heads, 63 sectors/track, 2024 cylinders Disk identifier: 0x00000000 Disk /dev/mapper/vg01-logvol00: 4294 MB, 4294967296 bytes 255 heads, 63 sectors/track, 522 cylinders
Disk identifier: 0x00000000 Disk /dev/mapper/vg02-logvol00: 4294 MB, 4294967296 bytes 255 heads, 63 sectors/track, 522 cylinders Disk identifier: 0x00000000 Disk /dev/sdf: 1073 MB, 1073741824 bytes 34 heads, 61 sectors/track, 1011 cylinders Units = cylinders of 2074 * 512 = 1061888 bytes Disk identifier: 0x00000000 Disk /dev/sde: 1073 MB, 1073741824 bytes 34 heads, 61 sectors/track, 1011 cylinders Units = cylinders of 2074 * 512 = 1061888 bytes Disk identifier: 0x00000000 # now format the new detected disk [root@server2 /]# fdisk /dev/sdf Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0xea693bea. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): n Command action e extended p primary partition (1-4) 1 Invalid partition number for type `1' Command action e extended
p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-1011, default 1): Using default value 1 Last cylinder, +cylinders or +size{k,m,g} (1-1011, default 1011): Using default value 1011 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. [root@server2 /]# fdisk /dev/sde Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0xc4c0bd58. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-1011, default 1): Using default value 1 Last cylinder, +cylinders or +size{k,m,g} (1-1011, default 1011): Using default value 1011 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. # create the ext4 filesystem [root@server2 /]# mkfs.ext4 /dev/sde1 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 65536 inodes, 262094 blocks 13104 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 8192 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 33 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. # create the ext4 filesystem [root@server2 /]# mkfs.ext4 /dev/sdf1 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 65536 inodes, 262094 blocks 13104 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 8192 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 37 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. [root@server2 /]# ls -l /dev/sd?1 brw-rw----. 1 root disk 8, 1 Aug 28 20:33 /dev/sda1 brw-rw----. 1 root disk 8, 17 Aug 28 20:33 /dev/sdb1
brw-rw----. 1 root disk 8, 33 Aug 28 20:33 /dev/sdc1 brw-rw----. 1 root disk 8, 49 Aug 28 20:33 /dev/sdd1 brw-rw----. 1 root disk 8, 65 Aug 28 20:39 /dev/sde1 brw-rw----. 1 root disk 8, 81 Aug 28 20:39 /dev/sdf1 # create the mount point directories [root@server2 /]# mkdir /data1 [root@server2 /]# mkdir /data2 # mount the disk to the mount directories [root@server2 /]# mount /dev/sde1 /data1 [root@server2 /]# mount /dev/sdf1 /data2 # create some files to test [root@server2 /]# cd /data1 [root@server2 data1]# touch test1 test2 test3 # create some files to test [root@server2 data1]# cd /data2 [root@server2 data2]# touch test4 test5 test6 [root@server2 data2]# ls -ltr total 16 drwx------. 2 root root 16384 Aug 28 20:45 lost+found -rw-r--r--. 1 root root 0 Aug 28 20:46 test6 -rw-r--r--. 1 root root 0 Aug 28 20:46 test5 -rw-r--r--. 1 root root 0 Aug 28 20:46 test4 [root@server2 data2]# cd /data1 [root@server2 data1]# ls lost+found test1 test2 test3 [root@server2 data1]# ls -ltr total 16 drwx------. 2 root root 16384 Aug 28 20:44 lost+found -rw-r--r--. 1 root root 0 Aug 28 20:46 test3 # Edit the fstab file [root@server2 data1]# vi /etc/fstab # /etc/fstab # Created by anaconda on Tue Aug 6 13:01:15 2013 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info #
/dev/mapper/vg01-logvol01 / ext4 defaults 1 1 UUID=7d281752-3635-4ba7-a3cf-1aa99fc2e521 /boot ext4 defaults 1 2 /dev/mapper/vg01-logvol00 swap swap defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 /dev/sde1 /data1 ext4 _netdev 1 1 /dev/sdf1 /data2 ext4 _netdev 1 1 The last 2 line is the newly added line for the iscsi which we mounted on /data1 and /data2 directories respectively