Friday, November 12, 2010

Ubuntu: Set up iSCSI initiator and target

There will be a lot of posts about iSCSI hereafter, as I am working on the SAN protocol for my graduate project. This was the source I used : http://www.howtoforge.com/using-iscsi-on-ubuntu-9.04-initiator-and-target

This is what I did:
Follow the set up till creating logical volume.
If your system got a partition (/dev/sdan - where n is any number between 1 and 9) which is free and doesn’t contain a partition table(no data or os in it). Use Gparted to format the disk to any type. Then follow the steps below:

sudo fdisk -l(lower case L) - This will list the device partitions size and ID

pvcreate /dev/sda3 - I’m using this partition - On success it would say “Physical volume /dev/sda3 successfully created

vgcreate vg0 /dev/sda3 - On success “Volume group vg0 successfully created”. vg0 - name of the volume group. Any format is fine.< lvcreate -L20G -n storage_lun1 vg0 - From the source 3. After creating the logical volume, follow the source instructions. At the place of iqn.2001-04.com.example:storage.lun1 192.168.0.100 substitute your IP address. I’m going to have both target and initiator at the same computer for now. So I’m using 127.0.0.1 in place of 192.168.0.100 in all forthcoming commands. However, 3260 port number is same and it is default for iSCSI.

------------------------------------------------------------------------------------------------------------------------------------
Now the above post is good but once I partition the sdb disk and changed some file I had problem logging to target. This is the error I got.

iscsiadm: Could not login to [iface: default, target: iqn.2001-04.com.example:storage.disk2.amiens.sys1.xyz, portal: 192.168.1.101,3260]: iscsiadm: initiator reported error (15 - already exists) iscsiadm: Could not log into all portals. Err 15.

I tried couple of solutions like deleting the devices modules and taking a look at the /var/log/messages. Then I jumped at this page and all I had to install tgtadm service and it was piece of cake from there and simple solution to create small portions to act as targets. Since our project is about able to replay the iscsi event with session details as original event for problem diagnosis, for testing during development we need to create small partitions. I would keep updating about this project. If you need more details, do drop me an email.

No comments: