LUN Centralized Storage – Using Logical Partition – Part II


In our previous post, we have discsussed how to use our LVM partition as ISCSI LUN. Now we need to assign that lun to some server/initiator. Please follow below steps to attach the lun to the machine.

Client/Initiator:
Operating System: CentOS release 6.4
Hostname: client
IP Address: 192.168.1.6

Step 1: Install ISCSI initiator packages

[root@client ~]# yum install iscsi-initiator-utils.x86_64

Step 2: Initiator configuration setup

[root@client ~]# vi /etc/iscsi/iscsid.conf

#Uncomment and change this parameter

node.session.auth.authmethod = CHAP

node.session.auth.username = chapuser
node.session.auth.password = chappwd

Step 3: Discover the storage LUN

[root@client ~]# iscsiadm -m node -o show
# BEGIN RECORD 6.2.0-873.2.el6
node.name = iqn.2008-09.com.example:server.target1
node.tpgt = 1
node.startup = automatic
........
........
node.discovery_address = 192.168.1.5
node.discovery_port = 3260
node.discovery_type = send_targets
........
........
node.session.auth.authmethod = CHAP
node.session.auth.username = chapuser
node.session.auth.password = ********

........
........
node.conn[0].address = 192.168.1.5
node.conn[0].port = 3260
........
........
# END RECORD

[root@client ~]# iscsiadm --mode discoverydb --type sendtargets --portal 192.168.1.5 --discover
192.168.1.5:3260,1 iqn.2008-09.com.example:server.target1

Step 4: Add/Attach the LUN

[root@client ~]# iscsiadm -m node --login
Logging in to [iface: default, target: iqn.2008-09.com.example:server.target1, portal: 192.168.1.5,3260] (multiple)
Login to [iface: default, target: iqn.2008-09.com.example:server.target1, portal: 192.168.1.5,3260] successful.

Now check your server, the new storage disk (/dev/sdb) is attached in the server.

[root@client ~]# fdisk -l | grep /dev
Disk /dev/sda: 8589 MB, 8589934592 bytes
/dev/sda1 * 1 64 512000 83 Linux
/dev/sda2 64 1045 7875584 8e Linux LVM
Disk /dev/mapper/VolGroup-lv_root: 3833 MB, 3833593856 bytes
Disk /dev/mapper/VolGroup-lv_swap: 4227 MB, 4227858432 bytes
Disk /dev/sdb: 104 MB, 104857600 bytes

Format and use the LUN

[root@client ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xb960394f.
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)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1024, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1024, default 1024): +50M

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

Calling ioctl() to re-read partition table.
Syncing disks.

[root@client ~]# fdisk -l | grep /dev
Disk /dev/sda: 8589 MB, 8589934592 bytes
/dev/sda1 * 1 64 512000 83 Linux
/dev/sda2 64 1045 7875584 8e Linux LVM
Disk /dev/mapper/VolGroup-lv_root: 3833 MB, 3833593856 bytes
Disk /dev/mapper/VolGroup-lv_swap: 4227 MB, 4227858432 bytes
Disk /dev/sdb: 104 MB, 104857600 bytes
/dev/sdb1 1 513 51275 83 Linux

That’s all.. Cheers 🙂

LUN Centralized Storage – Using Logical Partition – Part I


We are able to share logical partition to another machine using ISCSI method. So LVM can be act as a storage server and share the LUNS to clients.

Server/Target:
Operating System: CentOS release 6.4
Hostname: server
IP Address: 192.168.1.5

Step 1: Install ISCSI target package

[root@server ~]# yum install scsi-target-utils

Step 2: Create PV/VG/LV

[root@server ~]# pvcreate /dev/sdb{1,2}
Physical volume "/dev/sdb1" successfully created
Physical volume "/dev/sdb2" successfully created

[root@server ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda1 VolGroup00 lvm2 a-- 19.53g 2.88g
/dev/sdb1 lvm2 a-- 509.84m 509.84m
/dev/sdb2 lvm2 a-- 109.82m 109.82m

[root@server ~]# vgcreate vg01 /dev/sdb{1,2}
Volume group "vg01" successfully created

[root@server ~]# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup00 1 2 0 wz--n- 19.53g 2.88g
vg01 2 0 0 wz--n- 616.00m 616.00m

[root@server ~]# lvcreate -L 100M -n lv01 /dev/vg01
Logical volume "lv01" created

[root@server ~]# lvs
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
LogVol00 VolGroup00 -wi-ao--- 14.65g
LogVol01 VolGroup00 -wi-ao--- 2.00g
lv01 vg01 -wi-a---- 100.00m

Step 3: Target configuration

[root@server ~]# vi /etc/tgt/targets.conf


target iqn.2008-09.com.example:server.target1
backing-store /dev/vg01/lv01
initiator-address 192.168.1.6
incominguser chapuser chappwd
/target

Start the ISCSI daemon

[root@server ~]# /etc/init.d/tgtd start
Starting SCSI target daemon: [ OK ]

Check the target status

[root@server ~]# tgtadm --mode target --op show
Target 1: iqn.2008-09.com.example:server.target1
System information:
Driver: iscsi
State: ready
I_T nexus information:
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00010001
SCSI SN: beaf11
Size: 105 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: rdwr
Backing store path: /dev/vg01/lv01
Backing store flags:
Account information:
chapuser
ACL information:
192.168.1.6

Install Openfiler as a Guest OS in VirtualBox


In my previous post we have seen the steps to install VirtualBox on CentOS. Here we are going to see the steps to install Openfiler as a guest os on VirtualBox.

After installing VirtualBox follow the steps below.

The term “Guest OS” refers to the operating system which is to be installed inside a VirtualBox.

Step1: Create a Virtual Machine

First job is to create a virtual machine, to do open VirtualBox and click “New” from the toolbar.

Select “New” from the toolbar to create a new Virtual Machine

Enter any name for your Virtual Machine and select the Operating System you are going to use as your GUEST OS. ie., Enter Openfiler in Name field

Select the OS you are going to use inside your Virtual Machine. ie., Select the type as Linux and Version is Linux 2.6 (64 bit)

Select the amount of RAM to be allocated to the Virtual Machine. ie., Minimum RAM should be 512MB

You need to create a Virtual Hard disk for your Virtual Machine. ie., Minimum 10GB Dynamic Partition

Step 2: Change the boot order of the VM

Right click the newly created Virtual machine and go to settings.

Go to the settings of your Virtual Machine

Select storage from the left side list, select the CD icon and from the right select “Choose a virtual CD/DVD disk file”, navigate to the Openfiler ISO image file of the OS on your computer. Now the OS image is mounted to your Virtual machine.

To change the boot device order of your virtual machine go to the “System” option from the left side list, select Hard Disk and click the up arrow to bring it to the top of the list. Make the CD/DVD-ROM the second device and uncheck the other devices.

Set the boot device priority for the virtual machine.

Step 3: Start the Virtual machine

To start the virtual machine double-click the VM, a window opens here you can press F12 if you want to select a device of your choice to boot.

Press F12 to select the boot device of your choice

To boot from the CD-ROM press c.

Press c to boot the VM from a CD image

Your VM will now boot from your Operating System image file and the OS installation will start as usual.

Step 4: Openfiler Installation

Use the below link to install and configure openfiler guest os.

http://www.openfiler.com/learn/how-to/graphical-installation