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
- <targetiqn.2014-07.com.tecmint:tgt1>
- Backing-store/dev/vg_iscsi/lv_iscsi
- Backing-store/dev/vg_iscsi/lv_iscsi
- </target>
- ISCSI takes a qualified name (IQN.2014-07.COM.TECMINT:TGT1).
- Name whatever you want.
- Used to determine the target name, which is the first target in this server
- LVM shares specific Lun,backstore view the disk path through FDISK-L
service tgtd start
- #tgtadm--mode target--op Show
Tgt-admin--show
The above command lists the following information for the available LUNs
- ISCSI qualified Name
- ISCSI is ready.
- Default LUN 0 is reserved by the controller
- LUN 1 is the target we define.
- Here I have defined 4GB for each LUN
- 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