What is ISCSI
iSCSI, which stands for Internet Small Computer System Interface, works on top of the Transport Control Protocol (TCP) and allows the SCSI command to be sent end-to-end over local-area networks (LANs), wide-area networks (WANs) or the Internet. IBM developed iSCSI as a proof of concept in 1998, and presented the first draft of the iSCSI standard to the Internet Engineering Task Force (IETF) in 2000. The protocol was ratified in 2003.
How ISCSI works
iSCSI works by transporting block-level data between an iSCSI initiator on a server and an iSCSI target on a storage device. The iSCSI protocol encapsulates SCSI commands and assembles the data in packets for the TCP/IP layer. Packets are sent over the network using a point-to-point connection. Upon arrival, the iSCSI protocol disassembles the packets, separating the SCSI commands so the operating system (OS) will see the storage as a local SCSI device that can be formatted as usual. Today, some of iSCSI’s popularity in small to midsize businesses (SMBs) has to do with the way server virtualization makes use of storage pools. In a virtualized environment, the storage pool is accessible to all the hosts within the cluster and the cluster nodes nodes communicate with the storage pool over the network through the use of the iSCSI protocol.
ISCSI target install
Have a clean updated ubuntu server with alot of disk space. In this tutorial i will use a 5.5TB setup. 5TB for the iscsi and 500GB for the system.
sudo apt-get update sudo apt-get upgrade
Install the iSCSI target(iscsitarget) and iscsitarget-dkms.
sudo apt-get install iscsitarget iscsitarget-dkms
edit /etc/default/iscsitarget. Change the default value of ISCSITARGET_ENABLE=false over to ISCSITARGET_ENABLE=true. Not doing so will not allow the target to start.
sudo nano /etc/default/iscsitarget
When working with iSCSI you have to also think of LUN’s. This when you decide whether you want to use files or partitions when offering the targets storage to the iSCSI clients. For the tutorial I will be using files.
To create a file we can use dd to create and empty file that will grow once the users start storing file in it. The file weights 5000GB.
sudo mkdir /media/volume0 sudo dd if=/dev/zero of=/media/volume0/storlun0.bin count=0 obs=1 seek=5000G
I want to store the resulting files in a different path than my home directory which is why I specified that the file be deposited at /media/volume0.
Configurations and targets we create can be found in the /etc/iet/ietd.confconfiguration file.
sudo nano /etc/iet/ietd.conf
Scroll to the bottom of the configuration file and add:
Target iqn.2012-05.local.mynet:storage.sys0 Lun 0 Path=/media/volume0/storlun0.bin,Type=fileio,ScsiId=lun0,ScsiSN=lun0
All that is left to do is restart the target with our changes.
sudo service iscsitarget restart