Redundant array of #RAID卷 independent disks
RAID is a combination of multiple independent hard disks (physical hard disks) in different ways to form a hard disk group (logical hard disk), providing higher storage performance than a single hard drive and providing data backup technology. Different ways of composing a disk array become RAID level (RAID levels).
The function of data backup is that when the user data is damaged, the data can be recovered by using the backup information, thus guaranteeing the security of user data. As the user looks, the group of disks is like a hard disk, which the user can partition, format, and so on. In summary, the operation of the disk array is identical to a single hard drive. The difference is that the disk array is much faster to store than a single drive and can provide automatic data backup.
The two main features of RAID technology are: speed, second, security.
Raid+iscsi
raid level minimum HDD maximum fault tolerance available capacity read performance write performance Security purpose &NB Sp Application Industries
0 2 0 n n n One hard drive exception, Pursue maximum capacity &NBS P 3D industry real-time rendering,
All hard drives will be abnormal speed video splicing cache
1 2 n-1 1 n 1 highest, one is pursuing the largest Personal, Enterprise backup
Constant security
5 3 1 n-1 n-1 n-1 High Pursuit of maximum capacity personal, enterprise backup
, minimum budget
4 N/2 n/2 n N/2 High safety Comprehensive RAID 0/1 Benefits large database, server
, the theoretical speed is faster
Check if the disk is in a RAID group.
# Mdadm--EXAMINE/DEV/SDB/DEV/SDC/DEV/SDD/DEV/SDE
Start creating RAID0
# mdadm-c/dev/md0-ayes-l0-n2/dev/sd[b,c]1
# Cat/proc/mdstat
# mdadm-d/dev/md0
Create/etc/mdadm.conf
# echo Device/dev/sd{b,c}1 >>/etc/mdadm.conf
# Mdadm–ds >>/etc/mdadm.conf
# cat/etc/mdadm.conf
Device/dev/sdb1/dev/sdc1
array/dev/md0 level=raid0 num-devices=2 uuid=5160ea40:cb2b44f1:c650d2ef:0db09fd0
Start creating RAID1
# mdadm-c/dev/md1-ayes-l1-n2/dev/sd[d,e]1
Add RAID1 to RAID configuration file/etc/mdadm.conf and modify
# echo Device/dev/sd{b,c}1 >>/etc/mdadm.conf
# Mdadm–ds >>/etc/mdadm.conf
Start creating RAID5
# mdadm-c/dev/md5-ayes-l5–n3-x1/dev/sd[f,g,h,i]1
Add RAID5 to RAID configuration file/etc/mdadm.conf and modify
# echo Device/dev/sd{f,g,h,i}1 >>/etc/mdadm.conf
# Mdadm–ds >>/etc/mdadm.conf
# mdadm/dev/md5-a/DEV/SDH1 #增加一块备份盘
# mdadm-g/dev/md5-n4 #将备份盘转为数据盘
Note: Increase file system after expansion
# RESIZE2FS/DEV/MD5
To modify a RAID configuration file/etc/mdadm.conf
Create Raid10
# mdadm-c/dev/md1-ayes-l1-n2/dev/sd[c-d]1
# mdadm-c/dev/md1-ayes-l1-n2/dev/sd[e-f]1
# Cat/proc/mdstat
# mdadm-c/DEV/MD10-AYES-L0-N2/DEV/MD1/DEV/MD2
Create Raid6
# mdadm-c/dev/md1-ayes-l1-n2/dev/sd[b-e]1
# Mdadm--ADD/DEV/MD0/DEV/SDF1 #增加备份盘
Mdadm--create--auto=yes/dev/md0--level=5--raid-devices=4--spare-devices=1/dev/sd[b-f]
Parameter description:
--create//indicates to create raid
--AUTO=YES/DEV/MD0//Newly established software disk array device for MD0,MD sequence number can be 0-9
--LEVEL=5//disk array level, here is the creation Yes RAID5
--raid-devices//Add the number of blocks of disks used as disk arrays
--spare-devices//Add the number of blocks as a prestaged (spare) disk
/DEV/SD[B-F]//The device used by the disk array can also be written as/dev/sdb/dev/sdc/dev/sdd/dev/sde/dev/sdf
Mdadm-c/dev/md0-a Yes-l5-n4-x1/dev/sd[b-f] #此为上面命令的另一种写法. Four hard drives create RAID5
Cat/proc/mdstat #查看创建进程
Mdadm--detail/dev/md0 #查看详细信息
Mdadm-q/dev/md0 #查看整体概要信息
Mkfs.ext4/dev/md0 #创建文件系统
MKDIR/MNT/RAID5 #创建挂载点
mount/dev/md0/mnt/raid5/#挂载验证文件系统
Mdadm--detail--scan >>/etc/mdadm.conf #提取UUID和配置文件内容
Vim/etc/mdadm.conf #必须这么改, otherwise md0 will change to md127 after reboot
array/dev/md/md0 metadata=1.2 Spares=1 name=localhost.localdomain:0 uuid=81ab08a0:3af1700c:5bdd7f83:bf542889
Vim/etc/fstab #修改自动挂载
Mdadm--ADD/DEV/MD0/DEV/SDG
Mdadm--manage/dev/md0--ADD/DEV/SDG #增加新硬盘
Mdadm--grow/dev/md0-n5 #增加新硬盘到raid5中
Cat/proc/mdstat #查看新增硬盘sdg
Resize2fs-f/dev/md0 #重新调整文件系统的大小
Df-th #查看当前硬盘大小状态
Mdadm--manage/dev/md0--FAIL/DEV/SDD #模拟硬盘失效
Mdadm--detail/dev/md0 #查看raid5重建过程.
Cat/proc/mdstat #查看raid5重建过过程
ls/mnt/raid5/#差可能raid5仍然可用
Mdadm--manage/dev/md0--REMOVE/DEV/SDD #移除损坏的硬盘
Mdadm--manage/dev/md0--ADD/DEV/SDG #增新的硬盘
Mdadm--detail/dev/md0 #查看raid5目前状态
----------------Close the raid----------------------
Umount/dev/md0
Vim/etc/fstab #注释自动挂在
Vim/etc/mdadm.conf #注释配置文件
Mdadm--stop/dev/md0 #停止raid
Mdadm--misc--zero-superblock/dev/sd[b-f] #释放raid内硬盘
RAID0 and RAID1 in RAID5
RAID0: Parallel read and write data
RAID1: Mirrored disk
iSCSI Storage Server *****************
Service side: Bottom LVM+ISCSI Service
Client: iSCSI Login +LVM
Service side:
Yum Install Scsi-target-utils-y
Fdisk-l
Fdisk-cu/dev/sdb
Partx-a/dev/sdb
Pvcreate/dev/sdb1/dev/sdb2
Pvdisplay
PVs
Vgcreate VG00/DEV/SDB1
Vgdisplay
VGs
Lvcreate-l 500m-n lv00 vg00
Lvdisplay
Lvs
Yum Install iscsi*-y
Yum Install perl*-y
Vim/etc/tgt/targets.conf
<target iqn.2016-08.com.example:lv00>
backing-store/dev/vg00/lv00
Initiator-address 192.168.56.201
</target>
Note:
Target
's name should be unique within the same subnet, and the standard naming method is:
iqn.yyyy-mm.<reversed Domain Name>[:identifier]
Where: iqn: Indicates "ISCSI qualified Name", abbreviated as IQN.
YYYY-MM: Represents the year-month. This is 2011-08.
Reversed domain Name: this is com.example.
Identifier: Indicates the identification code, this is disk
Backing-store is used to designate a storage device, typically a non-physical disk, such as an LVM volume, a partition, a RAID disk array.
The initiator-address address is used to assign target to the specified client.
/ETC/INIT.D/TGTD start
Netstat-anput | grep 3260
Iptables-f
/etc/init.d/iptables Save
Tgtadm--lld iSCSI--op show--mode Target
When you create an iSCSI object using the Tgtadm tool, the primary command options are as follows:
-L,--LLD: Specifies the drive type, such as "-L iSCSI", which represents the iSCSI storage.
-o,--op: Specifies the type of operation, such as "-O new" for Creation, "-O-delete" for deletion, and "-O-Show" for viewing information.
-m,--mode: Specifies the management target, such as "-M target" that represents the iSCSI object.
-t,--tid: Specifies an object ID number, such as "-T 1" for the first object.
-T,--targetname: Specifies the name of the iSCSI object.
Client:
Yum Install iscsi-initiator-utils lsscsi-y
/ETC/INIT.D/ISCSI start
Iscsiadm-m discovery-t st-p 192.168.56.200
Iscsiadm-m node-t iqn.2016-08.com.example:lv00-p 192.168.56.200-l
ll/dev/disk/by-path/
/ETC/INIT.D/ISCSI status
DMESG | Tail
Automatic Login on Boot
# iscsiadm-m node–t iqn.1997-05.com.test:raid-p 192.168.1.1:3260--op update-n node.startup-v
Automatic
Fdisk-cu/dev/sdb
Partx-a/dev/sdb
Pvcreate/dev/sdb1
Vgcreate VG-DATA/DEV/SDB1
Lvcreate-l 200m-n Lv-data Vg-data
Mkfs.ext4/dev/vg-data/lv-data
mount/dev/vg-data/lv-data/data/
Df-th
echo "It is a test file" >>/data/test.txt
Blkid
Vim/etc/fstab
RAID Volume detailed