LUN is a Logical Unit Number, which shared from the iSCSI Storage Server. The Physical drive of iSCSI target server shares its drive to initiator over TCP/IP network. A Collection of drives called LUNs to form a large storage as SAN (Storage Area Network). In real environment LUNs are defined in LVM, if so it can be expandable as per space requirements.
Why LUNS are Used?
LUNS used for storage purpose, SAN Storage’s are build with mostly Groups of LUNS to become a pool, LUNs are Chunks of a Physical disk from target server. We can use LUNS as our systems Physical Disk to install Operating systems, LUNS are used in Clusters, Virtual servers, SAN etc. The main purpose of Using LUNS in Virtual servers for OS storage purpose. LUNS performance and reliability will be according to which kind of disk we using while creating a Target storage server.
Requirements
To know about creating a ISCSI Target Server follow the below link.
Master Server Setup
System information’s and Network setup are same as iSCSI Target Server as shown in Part – I, As we are defining LUNs in same server.
- Operating System – CentOS release 6.5 (Final)
- iSCSI Target IP – 192.168.0.200
- Ports Used : TCP 860, 3260
- Configuration file : /etc/tgt/targets.conf
Creating LUNs using LVM in iSCSI Target Server
First, find out the list of drives using fdisk -l command, this will manipulate a long list of information of every partitions on the system.
The above command only gives the drive information’s of base system. To get the storage device information, use the below command to get the list of storage devices.
NOTE: Here vda is virtual machines hard drive as I’m using virtual machine for demonstration, /dev/sda is added additionally for storage.
Step 1: Creating LVM Drive for LUNs
We going to use /dev/sda drive for creating a LVM.
Now let’s Partition the drive using fdisk command as shown below.
- The option ‘-c‘ switch off the DOS compatible mode.
- The option ‘-u‘ is used to listing partition tables, give sizes in sectors instead of cylinders.
Choose n to create a New Partition.
Choose p to create a Primary partition.
Give a Partition number which we need to create.
As here, we are going to setup a LVM drive. So, we need to use the default settings to use full size of Drive.
Choose the type of partition, Here we need to setup a LVM so use 8e. Use l option to see the list of type.
Choose which partition want to change the type.
After changing the type, check the changes by print (p) option to list the partition table.
Write the changes using w to exit from fdisk utility, Restart the system to make changes.
For your reference, I’ve attached screen shot below that will give you a clear idea about creating LVM drive.
After system reboot, list the Partition table using the following fdisk command.
Step 2: Creating Logical Volumes for LUNs
Now here, we going to create Physical volume using using ‘pvcreate’ command.
Create a Volume group with name of iSCSI to identify the group.
Here I’m defining 4 Logical Volumes, if so there will be 4 LUNs in our iSCSI Target server.
List the Physical volume, Volume group, logical volumes to confirm.
For better understanding of the above command, for your reference I’ve included a screen grab below.
Step 3: Define LUNs in Target Server
We have created Logical Volumes and ready to use with LUN, here we to define the LUNs in target configuration, if so only it will be available for client machines (Initiators).
Open and edit Targer configuration file located at ‘/etc/tgt/targets.conf’ with your choice of editor.
Append the following volume definition in target conf file. Save and close the file.
- iSCSI qualified name (iqn.2014-07.com.tecmint:tgt1).
- Use what ever as your wish.
- Identify using target, 1st target in this Server.
- 4. LVM Shared for particular LUN.
Next, reload the configuration by starting tgd service as shown below.
Next verify the available LUNs using the following command.
The above command will give long list of available LUNs with following information.
- iSCSI Qualified Name
- iSCSI is Ready to Use
- By Default LUN 0 will be reserved for Controller
- LUN 1, What we have Defined in the Target server
- Here i have defined 4 GB for a single LUN
- Online : Yes, Its ready to Use the LUN
'엔지니어 > Linux' 카테고리의 다른 글
CentOS에서 iSCSI Target 생성 및 관리 (0) | 2016.11.18 |
---|---|
ISCSI 설정하기 (0) | 2016.11.18 |
Solr 설치 및 data import (0) | 2016.11.18 |
/var/log/messages 에 명령어 history 넣기 (0) | 2016.11.18 |
centos 6 python3 설치 (0) | 2016.11.18 |