MRKAVANA (mrkavana@gmail.com) - www.facebook.com/kavanathai

Jul 18, 2011

How to install and configure Openfiler iscsi target

Openfiler is a os / sw for implementing or configuring iscsi devices. Suppose your company doesnt have a SAN storage. But you want a shared disk for one application. You can use openfiler here. With openfiler you can create a iscsi target. And by installing the proper iscsi initiator on the client you can mount the openfiler's iscsi target on your client. In background its just redhat rhel linux.

Iscsi-initiator [client]        <----------------------------------         Openfiler Iscsi-target

In this example we are using openfiler as iscsi target and a Rhel5 machine as iscsi initiator.

Openfiler Installation and configuration:

Download the openfiler openfiler-2.3-x86-disc1.iso from Openfiler website. Installation steps are shown below.
















Just hit enter for starting the installation.














You can do a media check if you want. You can skip it.














nstallation process is starting. Just hit enter. 














Chose the keyboard. Default is U.S. English














Check the Mannual pratition with Disk Druid and hit enter.















Enter yes for continuing.
















Here we'll create:
A /boot partiton of 100M size with ext3 filesystem.
A / partition with 4000M size with ext3 filesystem.
A swapfilesystem with 1024M size.














Click next for continuing installation.














Click "No" for continuing. It is recommented that you should have a 2Gb RAM on openfiler system.
Unckeck the dhcp option. Ckeck activate on boot. And give ip and netmask for the openfiler system. Here it is













IP: 192.168.0.29
Netmask: 255.255.255.0















Give the gateway and DNS settings for openfiler system. Rest is optional.

GW: 192.168.0.1
DNS: 8.8.8.8

Installation is about to start.
Hit enter.














Installation is on progress. Wait for completing. 
 













Installation is completed.Click reboot for rebooting you machine.
 















After rebooting you will get a screen like this. You can login as a root user.











In this machine password set was redhat. In the screen its shown that you can access the openfiler web interface through

https://192.168.0.29:446

But before that a few things to be done.

Configuring the web interface:

For accessing openfiler through web interface you need a web server configured. Apache comes as configured with opefiler. But you have to start the service.

[root@openfiler ~]# /etc/init.d/httpd start
Starting httpd: [ OK ]
[root@openfiler ~]# chkconfig httpd on

And you need to start the openfiler servicce also.

[root@openfiler ~]# /etc/init.d/openfiler start
Starting openfiler:
[root@openfiler ~]# chkconfig openfiler on

Now take the browser and give https://192.168.0.29:446
You may get an ssl error, but you can proceed.
Username  : openfiler
password   : redhat                     //default it'll be password. here i changed to redhat.

Web Interface:














First you need to set a Network access Point. This machine / network will be used as client.
If you are setting a iscsi device for a host, u need to give 255.255.255.255 as netmask.
If you are setting a iscsi device for a network, u can give 255.255.255.0 as netmask.

Take the web interface and click the system tab:


Creating Volumes:










Openfiler uses the LVM concept. First it will create a Physical volume. After that it will create Volume group and then the Logical Volume.

First we will create a Physical Volume:
Click Volume tab:
Click new physical volume link











You will get a page as above. Click /dev/sda in the edit disk column.











We 'll create an extended partition first. You may dont have to do this if it is already created.
After that in that extended partition, we will create a new partition as physical volume. As shown below.










Now we will create the Volume Group using the create physical volume. You can create more physical volumes and make a volume group using all those physical volumes.

Click Shares: 
 






 




Click create a new filesystem volume.


















Now we gave the Volume group the name storage. Now click change to create new Logical Volume in that.

Give the name: disk1

Description : disk1

Size : drage to full size or specify as much you want

Type : iscsi

The Logical volume is created. You can create more if you want. Now we want to set up the LUN.

Configuring LUN:


Before configuring LUN you need to enable the iscsi target service. Goto services tab:

















Before it was disabled now Iscsi target server became enabled. You just had to click.

Now we have to createa LUN device. Goto volumes tab. Click iscsi target on the right side window.










Clicking "add" you will get like this. You can edit the target name. After the ":" you can edit as you want. Here we gave *:storage.lap




















 

Now Goto LUN mapping tab under the Iscsi target.
Click on map.











Now You have to edit the Network acl and allow the host to use the mapped LUN. Click on Network acl.















Now the iscsi target from openfiler is mapped to the metwork access point. You can access it from that machine.














This is status of LUN after mapping. From systems tab iscsi-target.

Client [iscsi initiator] Configuration:
Here we are using a redhat enterprise linux5 as client. In order to use openfiler target as disk, it has to be set as iscsi initiator. For that we need to install the following package.
#rpm -ivh iscsi-initiator-utils-6.2.0.865-0.8.el5.i386.rpm

# service iscsid start
Turning off network shutdown. Starting iSCSI daemon: [ OK ]
[ OK ]

# chkconfig iscsid on
# chkconfig iscsi on

Searching the iscsi target:

# iscsiadm -m discovery -t sendtargets -p 192.168.0.29
You can also use port number if you want. As follows

# iscsiadm -m discovery -t sendtargets -p 192.168.0.29:3260
192.168.0.27:3260,1 iqn.2006-01.com.openfiler:storage.lap

You will get the scanned result as the line above.

Loging in to the iscsi target:

# iscsiadm -m node -T 192.168.0.27:3260,1 iqn.2006-01.com.openfiler:storage.lap -p 192.168.0.29 -l

-l or --login

#fdisk -l
will list the iscsi targets now.
Example:
[root@server ~]# iscsiadm -m discovery -t sendtargets -p 192.168.0.29
192.168.0.29:3260,1 iqn.2006-01.com.openfiler:storage.lap
[root@server ~]# iscsiadm -m node -T iqn.2006-01.com.openfiler:storage.lap -p 192.168.0.29 -l
[root@server ~]# fdisk -l

Disk /dev/sda: 18.2 GB, 18253611008 bytes
255 heads, 63 sectors/track, 2219 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 269 2219 15671407+ 83 Linux
/dev/sda3 14 268 2048287+ 82 Linux swap / Solaris

Partition table entries are not in disk order

Disk /dev/sdb: 5335 MB, 5335154688 bytes
165 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 10230 * 512 = 5237760 bytes
Disk /dev/sdb doesn't contain a valid partition table

Now we'll partition the iscsi device:

[root@server ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1018, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1018, default 1018):
Using default value 1018

Command (m for help): p

Disk /dev/sdb: 5335 MB, 5335154688 bytes
165 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 10230 * 512 = 5237760 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 1018 5207039 83 Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@server ~]# partprobe /dev/sdb

Checking the disks:
[root@server ~]# fdisk -l

Disk /dev/sda: 18.2 GB, 18253611008 bytes
255 heads, 63 sectors/track, 2219 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 269 2219 15671407+ 83 Linux
/dev/sda3 14 268 2048287+ 82 Linux swap / Solaris
Partition table entries are not in disk order

Disk /dev/sdb: 5335 MB, 5335154688 bytes
165 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 10230 * 512 = 5237760 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 1018 5207039 83 Linux

Now we'll format the disk:

[root@server ~]# mkfs.ext3 /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
651520 inodes, 1301759 blocks
65087 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1333788672
40 block groups
32768 blocks per group, 32768 fragments per group
16288 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@server ~]#

Mounting the Iscsi diskt to /tmp:

[root@server ~]# mount /dev/sdb1 /mnt
[root@server ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda2 ext3 15G 5.2G 8.7G 38% /
/dev/sda1 ext3 99M 10M 84M 11% /boot
tmpfs tmpfs 220M 0 220M 0% /dev/shm
/dev/sdb1 ext3 4.9G 139M 4.6G 3% /mnt

[root@server mnt]# touch a b c
[root@server mnt]# ls
a b c lost+found
[root@server mnt]#

No comments:

Post a Comment