Connect to SAN via ISCSI from Linux Ubuntu, Debian


You must install the open-iscsi package

apt-get install open-iscsi


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:
Also i like to change the initiator name location /etc/iscsi/initiatorname.iscsi
change the name and restart the open-iscsi service accordingly.


Start the service

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


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


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

iscsiadm -m node --login


Verify that the new partition has been created:

cat /proc/partitions


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

mkfs.ext3 /dev/sdX 


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


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


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

node.startup = automatic

Useful Web sites