Last month, we showed you how to build your own NAS box, and carried a
comprehensive guide to buy and even benchmark a NAS. This time we'll move into
even deeper waters and tell you how to build your own Storage Area Network.
Simply put, a storage area network is nothing but a high-speed network with
storage devices, like NAS boxes or even PCs with free hard drive space connected
to it. All these storage devices will appear as one large pool of storage to
everyone outside this network. Therefore, you'll be able to allocate storage
from this pool to your servers and applications. One benefit of doing this is
scalability. You can expand this storage pool whenever you need by adding more
storage devices to it. Moreover, since it's a network dedicated for storage, it
reduces overheads and improves data I/O. In this article, we'll tell you how to
build such a scalable storage-network.
|
The building blocks
The requirements for building your own SAN are simple. You need machines with
hard drives or NAS boxes, preferably with a Linux based OS. These would form the
storage pool, so the machines must have large hard drives to give you lots of
capacity. In SAN lingo, all of these machines are called targets. You'll need to
connect them to a Gigabit Ethernet switch, so that you have high-speed
connectivity between them. You'll also need another machine with Windows 2003
Server, which will act as the controller. This should have two network cards,
one going to the Gigabit Ethernet switch, and the other connecting to your LAN.
In SAN lingo, this server is called the Initiator. You'll also need the iSCSI
target and initiator software that needs to be installed on the respective
machines.
Setting up the storage pool
Take any Linux distribution and install it on all the PCs that you intend to use
for your storage pool. We used Fedora 6 Linux on all target machines and
installed it with the development tools option selected. Everything else should
be deselected, thereby giving a minimal install. During the installation, you
need to partition the hard drive on the target. First create a root partition of
8 GB for the FC 6 OS, create another one GB for the SWAP partition, and dedicate
the remaining space to /usr/local. This will be used as a part of the storage
pool, also known as the iSCSI target. Before installation, note down the
partition that you have dedicated for the iSCSI target. In our case, it was
/dev/hda2. As all target machines are sitting on an isolated network, assign
them a fixed IP address each and note it down. Next, go to this month's PCQuest
CD and take the iSCSI target software.
Alternately, you can also download it from http://tinyurl.com/2l4nhd. The
file is called iscsitarget-0.4.14.tar. Copy it to your FC 6 machine in a
separate folder in /usr/local and issue the following commands:
# tar -zxvf iscsitarget-0.4.14.tar
iSCSI Refresher |
iSCSI is a protocol that allows you to use SCSI commands over an IP network. It supports a Gigabit Ethernet interface at the physical layer, which lets you connect storage supporting iSCSI directly to the Gigabit switch so that the data moves from source to destination or vice versa at a very high speed. iSCSI has two main components-target and a controller. A target exposes the storage LUNs over the IP network so that the controller can discover them using an iSCSI initiator. It can then add them as the machine's local storage. So while it appears as a local storage, it's actually networked storage behind the scenes. When an iSCSI storage target device receives a read/write request, it generates the SCSI (I/O) command and then sends an IP packet over an Ethernet connection. At the receiving end (controller), the SCSI (I/O) commands are separated from the request, and then sent to the ISCSI target storage device. iSCSI will also return a response to the request using the same protocol. |
This command will extract all files in a folder named iscsitarget-0.4.14.
Then, go to this folder by using the # cd iscsitarget-0.4.14 command. It's also
very important to export the correct path for your kernel version's source. This
can be done by issuing the following command:
# export KERNELSRC= /usr/src/nels/2.6.18-1.2798.fc6-i586
Now, compile the iSCSI target software on this FC 6 machine as follows:
# make && make install
Once you have complied the iSCSI target on the target, you have to configure
it according to your requirement. For this issue the command:
# cp etc/ietd.conf /etc
Next open /etc/ietd.conf in a text editor and scroll down till you get to the
“Lun 0 path” entry and change the path of the partition that you have designated
for iSCSI target.
In our case, the iSCSI partition was /dev/hda2, so we changed it to “Lun 0
path=/dev/hda2”. Save this file and start the iSCSI target service on this
machine as follows:
# /etc/init.d/iscsi-target start
If you want to start this service automatically when this target machine
boots up issue the following command:
# chkconfig iscsi-target on
With this your target is ready. Similarly, add as many machines as you want
to your storage pool.
Add all iSCSI targets to your initiator running on the controller machine, and then use the pool of total storage |
Configuring the controller
To access the iSCSI storage, which is being exposed by the target machines on
the IP network, you need to install a software called iSCSI initiator on the
controller machine. This is available for both Windows and Linux. We used the
Microsoft iSCSI initiator, which can be freely downloaded from
http://tinyurl.com/ywtw3.
Install this software on your controller and you will get the Microsoft
initiator icon on your desktop. Double click on it and you will get its
interface with four tabs (General, Discovery, Targets, Persistent Target and
Bound volumes/devices). Go to the Discovery tab and add the iSCSI target you
have setup. Then select “Targets” tab and you will find all target names with
their status. On the same screen come down and select the Logon button. You will
get a popup screen with the logon to target options. Here enable “Automatically
restore this computer when the system boots” and click Ok.
Then apply the settings.
Now go to your Management Console and open Disk Management. If you've setup
the target machines in the initiator correctly, you should see a new drive in
your Disk Management. You can format this storage or create a new partition, or
do whatever else you do to a normal local drive. This drive will be treated like
an ordinary local drive, even though it's being accessed over the network. You
can share this partition on your local LAN so that network users can use it for
file sharing or whatever else you want them to use it for.
iSCSI targets for Windows
Instead of using FC 6, you can also use Windows. The concept remains the same.
You just have to find the right iSCSI target software for your OS. There are
quite a few iSCSI targets available for Windows, both from Microsoft and other
vendors. If you use the Microsoft iSCSI target, then there is a catch. Microsoft
iSCSI target only runs on the Windows 2003 Storage Server, and the latter is not
available as a commercial product. It's only sold to OEMs.
You will see all targets as inactive. To make them active for all iSCSI targets, you need to login each target from the initiator |
We also tried another commercial iSCSI target, called MySAN. We've carried it
on this month's CD as well for you to try out. It's very easy to use. A simple
setup wizard guides you through its installation. But the real work starts after
it's installed. Start MySAN from Program Files and go to the third tab which
says “Target”. Here select the partition/disk which you want to share over iSCSI.
Now click on the Add button to format the partition. This will also ask you for
the “Target name”. Give it a suitable name. This name will also represent the
Share. After you click on OK, the software will format your partition so make
sure you don't have any valuable data on it. Once the format is done go to the
tab called “Hosts”. Here you have to add the Host or the initiator which is
going to use the iSCSI share. Click on the add button and a new window will
open. Here fill in the Initiator node name. This name should be exactly the same
as the name of the initiator node given in the iSCSI initiator software such as
Microsoft iSCSI initiator. After you have done this, again go back to the
“Targets” and select the drive which you have just formatted. A drop down at the
bottom of the window will be highlighted. Click on the drop down box and you
will see the Initiator you have just added. Select it. Now go to the “General”
tab, select the Network card on which you want to let the share happen and click
on the “On” radio button. That's it. The configuration is done.
Now go to the machine on which you want to mount this iSCSI share. Install MS
iSCSI initiator on it exactly as you did in the previous (Linux) section. You
will get the Microsoft initiator icon on your desktop. Start the application
interface and select the discovery tab and add the ISCSI target you have you
have created. You can do that by providing the IP address or the machine name of
the target machine. Now select “Targets” tab and you will find the all target
names with their status. Now select the Logon button. You will get a popup
screen with the logon to target options. Here enable “Automatically restore this
computer when the system boots” and click ok and then apply the settings. The
volume will be available in the initiator machine.
That was about how to build a very basic SAN. You can use it to create a
common storage pool out of ordinary machines. In the next issue, we'll move
further in this and tell you how to build your own storage cluster.
Anindya Roy and Sanjay Majumder