Cinder process principle of mounting volume

Source: Internet
Author: User

Introduction to LVM Names

PV: Physical Disk

VG: Volume group, multiple PV can be composed of a VG, a VG can be divided into multiple LV (logical volume).

PP: a physical block that divides a VG logic into contiguous chunks.

LP: Logical block, a number of PP composed of one LP, multiple PP composed of a LP, similar to RAID0; one LP maps multiple PP mirrors, similar to RAID1.

LV: divided by VG, a number of successive LP composed of a LV (corresponding to the OS layer partition

LVM creation to mount to physical machine and to virtual machine experiment

Need to install LVM2

yum install lvm2

1. Mount the virtual machine with three EVs as a hard disk

2. Create PV

pv create /dev/vdc /dev/vdd /dev/vde

Pvscan View

3. Create VG

-S indicates the smallest block size

"Zhou" VG created successfully, contains three hard drives

Note: vgextend VG name Extended VG (vgreduce reduction)

4. Create the LV

lvcreate -L 20G -n lvname vgname

pvs;lvs;vgs;

Follow-up is the processing of the LV can be used after formatting

Server-side Installation

yum install scsi-target-utils

vim/etc/tgt/targets.conf

    1. <targetiqn.2014-07.com.tecmint:tgt1>
    2. Backing-store/dev/vg_iscsi/lv_iscsi
    3. Backing-store/dev/vg_iscsi/lv_iscsi
    4. </target>

    1. ISCSI takes a qualified name (IQN.2014-07.COM.TECMINT:TGT1).
    2. Name whatever you want.
    3. Used to determine the target name, which is the first target in this server
    4. LVM shares specific Lun,backstore view the disk path through FDISK-L

service tgtd start

    1. #tgtadm--mode target--op Show

Tgt-admin--show

The above command lists the following information for the available LUNs

    1. ISCSI qualified Name
    2. ISCSI is ready.
    3. Default LUN 0 is reserved by the controller
    4. LUN 1 is the target we define.
    5. Here I have defined 4GB for each LUN
    6. Online: Yes, this is the LUN you can use

Initiar End

1. Discover

iscsiadm -m discovery --type sendtargets --portal IP

2. Login SCSI, mount to physical machine

Command: Iscsiadm-m node-t <target-name>-P <ip-address>:<port>--login (automatic login after performing discovery)

#iscsiadm -m node -T iqn.2016-07.com.zmg:tgt2 -p 10.133.47.139:3260 --login

You can see that the LUN is mounted on the physical host, and then it is mounted to the virtual machine.

Port SCSI iscsiadm-m node-t [Target-name]-P [ip-address]–u

Fdisk can see that disk already appears on host

3. Mounting to a virtual machine

Attach this disk to a virtual machine and use Libvirt to implement

root:~#

virsh attach-disk instance-0000000b --source /dev/mapper/cinder--volumes-xxxxx --target vdc

Disk attached successfully

SSH into the virtual machine and found another disk.

Summary: LVM creates a LV and then defines the logical volume as the target device of the iSCSI storage, which will have the LUN ID, and then the client initiator end discovers the target device

, then log in to link the target device, mount the disk as a physical machine, and then mount it to the virtual machine via Libvirt driver.

Purpose: iSCSI is designed to connect storage devices over an IP network so that data storage is not subject to geographical restrictions.

Working principle:

iSCSI protocol top-down altogether can be divided into three layers:

1. SCSI layer: A SCSI CDB (command and Data Block) is established and passed to the iSCSI layer based on requests made by the client. The CDB (Command descriptor block) from the iSCSI layer is also received and the data is returned to the app.

2. iSCSI layer: SICSI CDB is encapsulated so that it can be transferred over a TCP/IP protocol-based network and complete a SCSI-to-TCP/IP protocol mapping. This layer is the core layer of the iSCSI protocol. (iSCSI protocol encapsulates SCSI packets as IP packets)

3. The TCP/IP layer: Routing and forwarding of IPs and providing end-to-end transparent and reliable transmission. (TCP/IP packet encapsulation)

Have a little trouble with the problem
Problem Description: SCSI server side and client can ping each other, but when the iSCSI client discover Scsi-targets, error No route to host firewall iptables reason to turn off Firewalld

Cinder process principle of mounting volume

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.