September 19, 2014 asvignesh 0Comment

Setup Environment

I have one Ubuntu server for iSCSI target and one Windows Machine for Initiator

Target Server

vignesh@vignesh-server:~$ sudo su

root@vignesh-server:~$ apt-get update

root@vignesh-server:~$ apt-get install iscsitarget

Note : If you have changed the kernel version (Upgraded your Ubuntu ) you may hit FATAL: Module iscsi_trgt not found. if you hit this issue run apt-get install iscsitarget-dkms

Creating Virtual Disk

Create a new virtual disk of desired size,I am creating 5000M

root@vignesh-server:~$ mkdir /mnt/iscsi
root@vignesh-server:~$ dd if=/dev/zero of=/mnt/iscsi/scsivdisk.img bs=1M count=5000
dd is the Unix command , reads from STDIN and STDOUT but these can be change using if (Input file)and of (Output file)
bs is the block size and count is number of blocks, default bs is 512

iSCSI Configuration

Enable iSCSI Target

The iSCSI target server is disabled by default, so we need to enable it in the configuration file

root@vignesh-server:~$ nano /etc/default/iscsitarget



Share Virtual Disk as Logical unit

We have to make the configuration in iSCSI Enterprise Target configuration

root@vignesh-server:~$ nano /etc/iet/ietd.conf
Lun 0 Path=/mnt/iscsi/scsivdisk.img,Type=fileio

We can add our own authentication rules IncomingUser <username> <password> Which is optional
Now the disk is shared with the whole network, you can make rules for sharing in /etc/iet/initiators.allow Which is optional
root@vignesh-server:~$ nano /etc/iet/initiators.allow

Start the service

Yes…. We are done… now we can start the service
root@vignesh-server:~$ /etc/init.d/iscsitarget start

6+ years of experience in building data protection, copy data management and storage management applications, automation software and plugins for private and public clouds

Disclaimer :

This is a personal weblog. The opinions expressed here represent my own and not those of my employer. my thoughts and opinions change from time to time… This weblog is intended to provide a semi-permanent point in time snapshot and manifestation of the various memes running around my brain, and as such any thoughts and opinions expressed within out-of-date posts may not the same, nor even similar, to those I may hold today.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.