Connect to SAN via ISCSI from Linux Ubuntu, Debian

First

You must install the open-iscsi package

apt-get install open-iscsi

Second

Configure the software by editing the /etc/iscsi/iscsi.conf file accordingly

If you do not require authentication there are no reasons to edit that file.
if you do follow the this link below:
http://www.cyberciti.biz/tips/rhel-centos-fedora-linux-iscsi-howto.html
Also i like to change the initiator name location /etc/iscsi/initiatorname.iscsi
change the name and restart the open-iscsi service accordingly.

Third

Start the service

/etc/init.d/open-iscsi status
/etc/init.d/open-iscsi start

Fourth

Now you have to discover the targets
First verify that there are no running sessions:

iscsiadm -m session -o show

The output should be: “iscsiadm: No active sessions.”

iscsiadm -m node -o show 

The output should be: “iscsiadm: no records found!”
Good! Now it is time to create a session:

iscsiadm -m discovery -t sendtargets -p 10.X.X.X

Fifth

Now you must login in in order to see the new block device:

iscsiadm -m node --login

Sixth

Verify that the new partition has been created:

cat /proc/partitions

Seventh

Now format the new block device by running the following command:

mkfs.ext3 /dev/sdX 

Eighth

Mount The new partition to a folder within /mnt or anywhere else you want to put it:

mkdir /mnt/iscsi_folder
mount /dev/sdX /mnt/iscsi_folder

Ninth

Make sure that open-iscsi is turn on at boot time

update-rc.d open-iscsi defaults

Make sure that you mount the the drive automatically at boot time:

vi /etc/fstab
/dev/sdX   /mnt/iscsi_folder    ext3    defaults    0    0

Tenth

Automate Target Logins, open /etc/iscsi/iscsi.config and edit the node.startup line to reflect the following:

node.startup = automatic

Useful Web sites
http://www.open-iscsi.org/docs/README
http://www.server-world.info/en/note?os=Ubuntu_12.04&p=iscsi&f=2
http://www.cyberciti.biz/tips/rhel-centos-fedora-linux-iscsi-howto.html
http://askubuntu.com/questions/2263/chkconfig-alternative-for-ubuntu-server
http://www.open-iscsi.org/index.html#docs
https://github.com/mikechristie/open-iscsi/blob/master/README

Let's share thisShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn