mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
20141217-2 选题
This commit is contained in:
parent
24eaa2d4de
commit
53e5d1942d
@ -0,0 +1,197 @@
|
||||
Centralized Secure Storage (iSCSI) – “Initiator Client” Setup on RHEL/CentOS/Fedora – Part III
|
||||
================================================================================
|
||||
**iSCSI** Initiator are the clients which use to authenticated with iSCSI target servers to access the LUNs shared from target server. We can deploy any kind of Operating systems in those locally mounted Disks, just a single package need to be install to get authenticate with target server.
|
||||
|
||||
![Client Initiator Setup](http://www.tecmint.com/wp-content/uploads/2014/07/Client-Initiator-Setup.jpg)
|
||||
|
||||
Client Initiator Setup
|
||||
|
||||
#### Features ####
|
||||
|
||||
- Can handle any kind of file systems in locally mounted Disk.
|
||||
- No need of restating the system after partition using fdisk.
|
||||
|
||||
#### Requirements ####
|
||||
|
||||
- [Create Centralized Secure Storage using iSCSI Target – Part 1][1]
|
||||
- [Create LUN’s using LVM in Target Server – Part 2][2]
|
||||
|
||||
#### My Client Setup for Initiator ####
|
||||
|
||||
- Operating System – CentOS release 6.5 (Final)
|
||||
- iSCSI Target IP – 192.168.0.50
|
||||
- Ports Used : TCP 3260
|
||||
|
||||
**Warning**: Never stop the service while LUNs Mounted in Client machines (Initiator).
|
||||
|
||||
### Initiator Client Setup ###
|
||||
|
||||
**1.** In Client side, we need to install the package ‘**iSCSI-initiator-utils**‘, search for the package using following command.
|
||||
|
||||
# yum search iscsi
|
||||
|
||||
**Sample Output**
|
||||
|
||||
============================= N/S Matched: iscsi ================================
|
||||
iscsi-initiator-utils.x86_64 : iSCSI daemon and utility programs
|
||||
iscsi-initiator-utils-devel.x86_64 : Development files for iscsi-initiator-utils
|
||||
|
||||
**2.** Once you locate the package, just install the initiator package using yum command as shown.
|
||||
|
||||
# yum install iscsi-initiator-utils.x86_64
|
||||
|
||||
**3.** After installing the package, we need to discover the share from **Target server**. The client side commands little hard to remember, so we can use man page to get the list of commands which required to run.
|
||||
|
||||
# man iscsiadm
|
||||
|
||||
![man iscsiadm](http://www.tecmint.com/wp-content/uploads/2014/07/man-iscsiadm.jpg)
|
||||
|
||||
man iscsiadm
|
||||
|
||||
**4.** Press **SHIFT+G** to Navigate to the Bottom of the man page and scroll little up to get the login example commands. We need to replace our **Target servers IP** address in below command Discover the Target.
|
||||
|
||||
# iscsiadm --mode discoverydb --type sendtargets --portal 192.168.0.200 --discover
|
||||
|
||||
**5.** Here we got the iSCSI (iqn) qualified name from above command execution.
|
||||
|
||||
192.168.0.200:3260,1 iqn.2014-07.com.tecmint:tgt1
|
||||
|
||||
![Discover Target](http://www.tecmint.com/wp-content/uploads/2014/07/Discover-Target.jpg)
|
||||
|
||||
Discover Target
|
||||
|
||||
**6.** To log-in use the below command to attach the LUN to our local System, this will authenticate with target server and allow us to log-in into LUN.
|
||||
|
||||
# iscsiadm --mode node --targetname iqn.2014-07.com.tecmint:tgt1 --portal 192.168.0.200:3260 --login
|
||||
|
||||
![Login To Target Server](http://www.tecmint.com/wp-content/uploads/2014/07/Login-To-Target-Server.jpg)
|
||||
|
||||
Login To Target Server
|
||||
|
||||
**Note**: Use the login command and replace login with logout at end of command.
|
||||
|
||||
# iscsiadm --mode node --targetname iqn.2014-07.com.tecmint:tgt1 --portal 192.168.0.200:3260 --logout
|
||||
|
||||
![Logout from Target Server](http://www.tecmint.com/wp-content/uploads/2014/07/Logout-from-Target-Server.jpg)
|
||||
|
||||
Logout from Target Server
|
||||
|
||||
**7.** After login to the LUN, list the records of Node using.
|
||||
|
||||
# iscsiadm --mode node
|
||||
|
||||
![List Node](http://www.tecmint.com/wp-content/uploads/2014/07/List-Node.jpg)
|
||||
|
||||
List Node
|
||||
|
||||
**8.** Display all data of a particular node.
|
||||
|
||||
# iscsiadm --mode node --targetname iqn.2014-07.com.tecmint:tgt1 --portal 192.168.0.200:3260
|
||||
|
||||
**Sample Output**
|
||||
|
||||
# BEGIN RECORD 6.2.0-873.10.el6
|
||||
node.name = iqn.2014-07.com.tecmint:tgt1
|
||||
node.tpgt = 1
|
||||
node.startup = automatic
|
||||
node.leading_login = No
|
||||
iface.hwaddress = <empty>
|
||||
iface.ipaddress = <empty>
|
||||
iface.iscsi_ifacename = default
|
||||
iface.net_ifacename = <empty>
|
||||
iface.transport_name = tcp
|
||||
iface.initiatorname = <empty>
|
||||
iface.bootproto = <empty>
|
||||
iface.subnet_mask = <empty>
|
||||
iface.gateway = <empty>
|
||||
iface.ipv6_autocfg = <empty>
|
||||
iface.linklocal_autocfg = <empty>
|
||||
....
|
||||
|
||||
**9.** Then list the drive using, fdisk will list every authenticated disks.
|
||||
|
||||
# fdisk -l /dev/sda
|
||||
|
||||
![List Disks](http://www.tecmint.com/wp-content/uploads/2014/07/List-Disks.jpg)
|
||||
|
||||
List Disks
|
||||
|
||||
**10.** Run fdisk to create a new partition.
|
||||
|
||||
# fdisk -cu /dev/sda
|
||||
|
||||
![Create New Partition](http://www.tecmint.com/wp-content/uploads/2014/07/Create-New-Partition.jpg)
|
||||
|
||||
Create New Partition
|
||||
|
||||
**Note**: After Creating a Partition using fdisk, we don’t need to reboot, as we used to do in our local systems, Because this is a remote shared storage mounted locally.
|
||||
|
||||
**11.** Format the newly created partition.
|
||||
|
||||
# mkfs.ext4 /dev/sda1
|
||||
|
||||
![Format New Partition](http://www.tecmint.com/wp-content/uploads/2014/07/Format-New-Partition.jpg)
|
||||
|
||||
Format New Partition
|
||||
|
||||
**12.** Create a Directory and mount the formatted partition.
|
||||
|
||||
# mkdir /mnt/iscsi_share
|
||||
# mount /dev/sda1 /mnt/iscsi_share/
|
||||
# ls -l /mnt/iscsi_share/
|
||||
|
||||
![Mount New Partition](http://www.tecmint.com/wp-content/uploads/2014/07/Mount-New-Partition.jpg)
|
||||
|
||||
Mount New Partition
|
||||
|
||||
**13.** List the Mount Points.
|
||||
|
||||
# df -Th
|
||||
|
||||
- **-T** – Prints files system types.
|
||||
- **-h** – Prints in human readable format eg : Megabyte or Gigabyte.
|
||||
|
||||
![List New Partition](http://www.tecmint.com/wp-content/uploads/2014/07/List-New-Partition.jpg)
|
||||
|
||||
List New Partition
|
||||
|
||||
**14.** If we need to permanently mount the Drive use fstab entry.
|
||||
|
||||
# vim /etc/fstab
|
||||
|
||||
**15.**Append the following Entry in fstab.
|
||||
|
||||
/dev/sda1 /mnt/iscsi_share/ ext4 defaults,_netdev 0 0
|
||||
|
||||
**Note:** Use _netdev in fstab, as this is a network device.
|
||||
|
||||
![Auto Mount Partition](http://www.tecmint.com/wp-content/uploads/2014/07/Auto-Mount-Partition.jpg)
|
||||
|
||||
Auto Mount Partition
|
||||
|
||||
**16.** Finally check whether our fstab entry have any error.
|
||||
|
||||
# mount -av
|
||||
|
||||
- **-a** – all mount point
|
||||
- **-v** – Verbose
|
||||
|
||||
![Verify fstab Entries](http://www.tecmint.com/wp-content/uploads/2014/07/Verify-fstab-Entries.jpg)
|
||||
|
||||
Verify fstab Entries
|
||||
|
||||
We have Completed Our client side configuration Successfully. Start to use the drive as we use our local system disk.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/iscsi-initiator-client-setup/
|
||||
|
||||
作者:[Babin Lonston][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/babinlonston/
|
||||
[1]:http://www.tecmint.com/create-centralized-secure-storage-using-iscsi-targetin-linux/
|
||||
[2]:http://www.tecmint.com/create-luns-using-lvm-in-iscsi-target/
|
@ -0,0 +1,148 @@
|
||||
Create Centralized Secure Storage using iSCSI Target on RHEL/CentOS/Fedora Part -I
|
||||
================================================================================
|
||||
**iSCSI** is a block level Protocol for sharing **RAW Storage Devices** over TCP/IP Networks, Sharing and accessing Storage over iSCSI, can be used with existing IP and Ethernet networks such as NICs, Switched, Routers etc. iSCSI target is a remote hard disk presented from an remote iSCSI server (or) target.
|
||||
|
||||
![Install iSCSI Target in Linux](http://www.tecmint.com/wp-content/uploads/2014/07/Install-iSCSI-Target-in-Linux.jpg)
|
||||
Install iSCSI Target in Linux
|
||||
|
||||
We don’t need a high resource for stable connectivity and performance in Client side’s. iSCSI Server called as Target, this share’s the storage from server. iSCSI Client’s called as Initiator, this will access the storage which shared from Target Server. There are iSCSI adapter’s available in market for Large Storage services such as SAN Storage’s.
|
||||
|
||||
**Why we need a iSCSI adapter for Large storage Area?**
|
||||
|
||||
Ethernet adapters (NIC) are designed to transfer packetized file level data among systems, servers and storage devices like NAS storage’s, they are not capable for transferring block level data over Internet.
|
||||
|
||||
### Features of iSCSI Target ###
|
||||
|
||||
- Possible to run several iSCSI targets on a single machine.
|
||||
- A single machine making multiple iscsi target available on the iSCSI SAN
|
||||
- The target is the Storage and makes it available for initiator (Client) over the network
|
||||
- These Storage’s are Pooled together to make available to the network is iSCSI LUNs (Logical Unit Number).
|
||||
- iSCSI supports multiple connections within the same session
|
||||
- iSCSI initiator discover the targets in network then authenticating and login with LUNs, to get the remote storage locally.
|
||||
- We can Install any Operating systems in those locally mounted LUNs as what we used to install in our Base systems.
|
||||
|
||||
### Why the need of iSCSI? ###
|
||||
|
||||
In Virtualization we need storage with high redundancy, stability, iSCSI provides those all in low cost. Creating a SAN Storage in low price while comparing to Fiber Channel SANs, We can use the standard equipment’s for building a SAN using existing hardware such as NIC, Ethernet Switched etc..
|
||||
|
||||
Let start to get install and configure the centralized Secure Storage using iSCSI Target. For this guide, I’ve used following setups.
|
||||
|
||||
- We need separate 1 systems to Setup the iSCSI Target Server and Initiator (Client).
|
||||
- Multiple numbers of Hard disk can be added in large storage environment, But we here using only 1 additional drive except Base installation disk.
|
||||
- Here we using only 2 drives, One for Base server installation, Other one for Storage (LUNs) which we going to create in PART-II of this series.
|
||||
|
||||
#### Master Server Setup ####
|
||||
|
||||
- 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
|
||||
|
||||
## Installing iSCSI Target ##
|
||||
|
||||
Open terminal and use yum command to search for the package name which need to get install for iscsi target.
|
||||
|
||||
# yum search iscsi
|
||||
|
||||
#### Sample Output ####
|
||||
|
||||
========================== N/S matched: iscsi =======================
|
||||
iscsi-initiator-utils.x86_64 : iSCSI daemon and utility programs
|
||||
iscsi-initiator-utils-devel.x86_64 : Development files for iscsi-initiator-utils
|
||||
lsscsi.x86_64 : List SCSI devices (or hosts) and associated information
|
||||
scsi-target-utils.x86_64 : The SCSI target daemon and utility programs
|
||||
|
||||
We got the search result as above, choose the **Target** package and install to play around.
|
||||
|
||||
# yum install scsi-target-utils -y
|
||||
|
||||
![Install iSCSI Utils](http://www.tecmint.com/wp-content/uploads/2014/07/Install-iSCSI-in-Linux.jpg)
|
||||
Install iSCSI Utils
|
||||
|
||||
List the installed package to know the default config, service, and man page location.
|
||||
|
||||
# rpm -ql scsi-target-utils.x86_64
|
||||
|
||||
![List All iSCSI Files](http://www.tecmint.com/wp-content/uploads/2014/07/List-All-ISCSI-Files.jpg)
|
||||
|
||||
List All iSCSI Files
|
||||
|
||||
Let’s start the iSCSI Service, and check the status of Service up and running, iSCSI service named as **tgtd**.
|
||||
|
||||
# /etc/init.d/tgtd start
|
||||
# /etc/init.d/tgtd status
|
||||
|
||||
![Start iSCSI Service](http://www.tecmint.com/wp-content/uploads/2014/07/Start-iSCSI-Service.jpg)
|
||||
|
||||
Start iSCSI Service
|
||||
|
||||
Now we need to configure it to start Automatically while system start-up.
|
||||
|
||||
# chkconfig tgtd on
|
||||
|
||||
Next, verify that the run level configured correctly for the tgtd service.
|
||||
|
||||
# chkconfig --list tgtd
|
||||
|
||||
![Enable iSCSI on Startup](http://www.tecmint.com/wp-content/uploads/2014/07/Enable-iSCSI-on-Startup.jpg)
|
||||
|
||||
Enable iSCSI on Startup
|
||||
|
||||
Let’s use **tgtadm** to list what targets and LUNS we currently got configured in our Server.
|
||||
|
||||
# tgtadm --mode target --op show
|
||||
|
||||
The **tgtd** installed up and running, but there is no **Output** from the above command because we have not yet defined the LUNs in Target Server. For manual page, Run ‘**man**‘ command.
|
||||
|
||||
# man tgtadm
|
||||
|
||||
![iSCSI Man Pages](http://www.tecmint.com/wp-content/uploads/2014/07/iSCSI-Man-Pages.jpg)
|
||||
|
||||
iSCSI Man Pages
|
||||
|
||||
Finally we need to add iptables rules for iSCSI if there is iptables deployed in your target Server. First, find the Port number of iscsi target using following netstat command, The target always listens on TCP port 3260.
|
||||
|
||||
# netstat -tulnp | grep tgtd
|
||||
|
||||
![Find iSCSI Port](http://www.tecmint.com/wp-content/uploads/2014/07/Find-iSCSI-Port.jpg)
|
||||
|
||||
Find iSCSI Port
|
||||
|
||||
Next add the following rules to allow iptables to Broadcast the iSCSI target discovery.
|
||||
|
||||
# iptables -A INPUT -i eth0 -p tcp --dport 860 -m state --state NEW,ESTABLISHED -j ACCEPT
|
||||
# iptables -A INPUT -i eth0 -p tcp --dport 3260 -m state --state NEW,ESTABLISHED -j ACCEPT
|
||||
|
||||
![Open iSCSI Ports](http://www.tecmint.com/wp-content/uploads/2014/07/Open-iSCSI-Ports.jpg)
|
||||
|
||||
Open iSCSI Ports
|
||||
|
||||
![Add iSCSI Ports to Iptables](http://www.tecmint.com/wp-content/uploads/2014/07/Add-iSCSI-Ports-to-Iptables.jpg)
|
||||
|
||||
Add iSCSI Ports to Iptables
|
||||
|
||||
**Note**: Rule may vary according to your **Default CHAIN Policy**. Then save the Iptables and restart the iptables.
|
||||
|
||||
# iptables-save
|
||||
# /etc/init.d/iptables restart
|
||||
|
||||
![Restart iptables](http://www.tecmint.com/wp-content/uploads/2014/07/Restart-iptables.jpg)
|
||||
|
||||
Restart iptables
|
||||
|
||||
Here we have deployed a target server to share LUNs to any initiator which authenticating with target over TCP/IP, This suitable for small to large scale production environments too.
|
||||
|
||||
In my next upcoming articles, I will show you how to [Create LUN’s using LVM in Target Server][1] and how to share LUN’s on Client machines, till then stay tuned to TecMint for more such updates and don’t forget to give valuable comments.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/create-centralized-secure-storage-using-iscsi-targetin-linux/
|
||||
|
||||
作者:[Babin Lonston][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/babinlonston/
|
||||
[1]:http://www.tecmint.com/create-luns-using-lvm-in-iscsi-target/
|
@ -0,0 +1,230 @@
|
||||
How to Create and Setup LUNs using LVM in “iSCSI Target Server” on RHEL/CentOS/Fedora – Part II
|
||||
================================================================================
|
||||
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.
|
||||
|
||||
![Create LUNS using LVM in Target Server](http://www.tecmint.com/wp-content/uploads/2014/07/Create-LUNS-inLVM.png)
|
||||
Create LUNS using LVM in Target Server
|
||||
|
||||
### 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.
|
||||
|
||||
- [Create Centralized Secure Storage using iSCSI Target – Part I][1]
|
||||
|
||||
#### 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.
|
||||
|
||||
# fdisk -l
|
||||
|
||||
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.
|
||||
|
||||
# fdisk -l /dev/vda && fdisk -l /dev/sda
|
||||
|
||||
![List Storage Drives](http://www.tecmint.com/wp-content/uploads/2014/07/1.jpg)
|
||||
|
||||
List Storage Drives
|
||||
|
||||
**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.
|
||||
|
||||
# fdisk -l /dev/sda
|
||||
|
||||
![List LVM Drive](http://www.tecmint.com/wp-content/uploads/2014/07/2.jpg)
|
||||
|
||||
List LVM Drive
|
||||
|
||||
Now let’s Partition the drive using fdisk command as shown below.
|
||||
|
||||
# fdisk -cu /dev/sda
|
||||
|
||||
- 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.
|
||||
|
||||
Command (m for help): n
|
||||
|
||||
Choose **p** to create a Primary partition.
|
||||
|
||||
Command action
|
||||
e extended
|
||||
p primary partition (1-4)
|
||||
|
||||
Give a Partition number which we need to create.
|
||||
|
||||
Partition number (1-4): 1
|
||||
|
||||
As here, we are going to setup a LVM drive. So, we need to use the default settings to use full size of Drive.
|
||||
|
||||
First sector (2048-37748735, default 2048):
|
||||
Using default value 2048
|
||||
Last sector, +sectors or +size{K,M,G} (2048-37748735, default 37748735):
|
||||
Using default value 37748735
|
||||
|
||||
Choose the type of partition, Here we need to setup a LVM so use **8e**. Use **l** option to see the list of type.
|
||||
|
||||
Command (m for help): t
|
||||
|
||||
Choose which partition want to change the type.
|
||||
|
||||
Selected partition 1
|
||||
Hex code (type L to list codes): 8e
|
||||
Changed system type of partition 1 to 8e (Linux LVM)
|
||||
|
||||
After changing the type, check the changes by print (**p**) option to list the partition table.
|
||||
|
||||
Command (m for help): p
|
||||
|
||||
Disk /dev/sda: 19.3 GB, 19327352832 bytes
|
||||
255 heads, 63 sectors/track, 2349 cylinders, total 37748736 sectors
|
||||
Units = sectors of 1 * 512 = 512 bytes
|
||||
Sector size (logical/physical): 512 bytes / 512 bytes
|
||||
I/O size (minimum/optimal): 512 bytes / 512 bytes
|
||||
Disk identifier: 0x9fae99c8
|
||||
|
||||
Device Boot Start End Blocks Id System
|
||||
/dev/sda1 2048 37748735 18873344 8e Linux LVM
|
||||
|
||||
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.
|
||||
|
||||
![Create LVM Partition](http://www.tecmint.com/wp-content/uploads/2014/07/3.jpg)
|
||||
|
||||
Create LVM Partition
|
||||
|
||||
After system reboot, list the Partition table using the following fdisk command.
|
||||
|
||||
# fdisk -l /dev/sda
|
||||
|
||||
![Verify LVM Partition](http://www.tecmint.com/wp-content/uploads/2014/07/4.jpg)
|
||||
|
||||
Verify LVM Partition
|
||||
|
||||
### Step 2: Creating Logical Volumes for LUNs ###
|
||||
|
||||
Now here, we going to create Physical volume using using ‘pvcreate’ command.
|
||||
|
||||
# pvcreate /dev/sda1
|
||||
|
||||
Create a Volume group with name of iSCSI to identify the group.
|
||||
|
||||
# vgcreate vg_iscsi /dev/sda1
|
||||
|
||||
Here I’m defining 4 Logical Volumes, if so there will be 4 LUNs in our iSCSI Target server.
|
||||
|
||||
# lvcreate -L 4G -n lv_iscsi vg_iscsi
|
||||
|
||||
# lvcreate -L 4G -n lv_iscsi-1 vg_iscsi
|
||||
|
||||
# lvcreate -L 4G -n lv_iscsi-2 vg_iscsi
|
||||
|
||||
# lvcreate -L 4G -n lv_iscsi-3 vg_iscsi
|
||||
|
||||
List the Physical volume, Volume group, logical volumes to confirm.
|
||||
|
||||
# pvs && vgs && lvs
|
||||
# lvs
|
||||
|
||||
For better understanding of the above command, for your reference I’ve included a screen grab below.
|
||||
|
||||
![Creating LVM Logical Volumes](http://www.tecmint.com/wp-content/uploads/2014/07/5.jpg)
|
||||
|
||||
Creating LVM Logical Volumes
|
||||
|
||||
![Verify LVM Logical Volumes](http://www.tecmint.com/wp-content/uploads/2014/07/6.jpg)
|
||||
|
||||
Verify LVM Logical Volumes
|
||||
|
||||
### 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.
|
||||
|
||||
# vim /etc/tgt/targets.conf
|
||||
|
||||
Append the following volume definition in target conf file. Save and close the file.
|
||||
|
||||
<target iqn.2014-07.com.tecmint:tgt1>
|
||||
backing-store /dev/vg_iscsi/lv_iscsi
|
||||
</target>
|
||||
<target iqn.2014-07.com.tecmint:tgt1>
|
||||
backing-store /dev/vg_iscsi/lv_iscsi-1
|
||||
</target>
|
||||
<target iqn.2014-07.com.tecmint:tgt1>
|
||||
backing-store /dev/vg_iscsi/lv_iscsi-2
|
||||
</target>
|
||||
<target iqn.2014-07.com.tecmint:tgt1>
|
||||
backing-store /dev/vg_iscsi/lv_iscsi-3
|
||||
</target
|
||||
|
||||
![Configure LUNs in Target Server](http://www.tecmint.com/wp-content/uploads/2014/07/7.jpg)
|
||||
|
||||
Configure LUNs in Target Server
|
||||
|
||||
- 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.
|
||||
|
||||
# /etc/init.d/tgtd reload
|
||||
|
||||
![Reload Configuration](http://www.tecmint.com/wp-content/uploads/2014/07/8.jpg)
|
||||
|
||||
Reload Configuration
|
||||
|
||||
Next verify the available LUNs using the following command.
|
||||
|
||||
# tgtadm --mode target --op show
|
||||
|
||||
![List Available LUNs](http://www.tecmint.com/wp-content/uploads/2014/07/9.jpg)
|
||||
|
||||
List Available LUNs
|
||||
|
||||
![LUNs Information](http://www.tecmint.com/wp-content/uploads/2014/07/10.jpg)
|
||||
|
||||
LUNs Information
|
||||
|
||||
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
|
||||
|
||||
Here we have defined the LUNs for target server using LVM, this can be expandable and support for many features such as snapshots. Let us see how to authenticate with Target server in PART-III and mount the remote Storage locally.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/create-luns-using-lvm-in-iscsi-target/
|
||||
|
||||
作者:[Babin Lonston][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/babinlonston/
|
||||
[1]:http://www.tecmint.com/create-centralized-secure-storage-using-iscsi-targetin-linux/
|
Loading…
Reference in New Issue
Block a user