Implementation of soft raid
Mdadm
-C: Creates an array.
-A: assembly
-F: Monitoring
-D--detail: Displays details.
Major: The main device number that distinguishes the device category.
Minor: the secondary device number used to distinguish between different devices in the same category.
-c/dev/md# Specifies the MD name created.
-a{yes|no}: Automatically create a device file for the RAID device you created/dev/md#
-L: Specifies the level of RAID.
-N: Specifies the number of block devices used for raid
-X: Specifies the number of disks to use for the spare.
-C: Specifies the track size.
Create file system: Mke2fs-t ext4/dev/md#
Example: Creating a Radi0
Mdadm-c/dev/md1-a yes-n 2-l 0/DEV/SDB1/DEV/SDC1
View Mdadm current running state when creating raid: Cat/proc/mdstat
Shows if the raid was created, and review the progress.
You can view information by using the periodic feedback information:
Watch: Show the execution results of a command on a regular basis
Example: Watch-n 1 ' cat/proc/mdstat '
Disk Management commands in the array:
mdadm/dev/md# option/dev/sd#
-F: Specify device emulation corruption
-r: Remove the damaged device.
-A: Replace the new hard drive.
Mdadm/dev/md1-f/DEV/SDB1 the disk SDB1 damage in the analog md1.
Deactivate MD
Mdadm-s/DEV/MD1
Dm:device Mapper
A kernel module that abstracts multiple block devices and physical devices into virtual devices.
Support for stripe, mirrored disk configuration mode.
Lvm:logical Volum Manager
LVM2 is the new DM tool.
If the analogy file system is the inner tube of the car, then the LV logical volume size is the tire, so in the expansion, reduction, according to the situation of the file system and the LV corresponding operation.
For example, when expanding, you need to resize2fs to adjust the file system size after the lvextend extension. When shrinking, you need to adjust the file system size RESIZE2FS and then make lvreduce adjustments.
It is highly recommended that you do not reduce the cost of the remaining piece of the company's hard disk than your position and data.
The advantages of LVM: Dynamically adjusting the logical volume partition size, snapshot backup.
Create PV:
1. Create VG There is no strict disk size limit on physical disks, that is, you can create PV using disks of different disk capacities, interfaces, and then create VG.
2, we recommend that you use FDISK to configure the disk as 8e,linux LVM type.
Created: pvcreate/dev/sdb{a-z}1
-F: Force creation
Pvdisplay: View PV information.
Create VG:
Vgcreate vgname/dev/sd{a-z}1
-S: Sets the PE size, (block similar to Physical disk). 8k-16g Default: 4M
Create LV:
Lvcreate-l size (200M)-N lvname vg_name
-L: Set the number of PE
-L: Set volume size (m/g/kb)
-N: Set the LV name
Device file location for logical Volume: two Select one
/dev/vg_name/lv_name
/dev/mapper/vgname-lvname
Format to create a file system
Mke2fs-t EXT4/DEV/MAPPER/TESTVG-LV
Mount use
Mount/dev/testvg/lv/mnt
Extended VG---vgextend
1. Add Disk to PV
Pvcreate/dev/sdb1
2. Add PV new disk to VG
Vgextend VG_BJHJ/DEV/SDB1
3. Extended LV Partition
Lvextend-l 22g/dev/vg_bjhj/lv_root
4. Format File system
Resize2fs/dev/vg_bjhj/lv_root
5. View partition status
Df-h
Reduced VG:
1. Determine the PV to be removed and move the data on this PV to other PV.
2. Remove PV from the volume group
Pvmove/dev/sdb1
Vgreduce TESTVG/DEV/SDB1
Viewing the data inside the LV is stored on that disk and can be viewed using PVS.
Practice:
1, analog LV inside a piece of hard disk damage (including data), whether the data can be accessed, if it is free, can be accessed.
A: Any disk corruption in the LV can cause loss of disk data and LV unusable.
2, create RAID0 1 5 LV volume, and simulate hard disk damage, see the effect.
assigning system partitions to logical volumes when installing the operating system
First of all, it is necessary to explain that the system through the CD-ROM installation, such as LVM and RAID are used in the software partition, relatively poor performance compared to the hardware.
Specific steps:
1. Select the disk---Create---lvm physical volume to create the physical volume size.
650) this.width=650; "src=" Http://note.youdao.com/yws/res/8193/006032158C8B40E5A50120C8754703AE "style=" Margin-top:8px;width:482.15488215488216px;height:auto; "alt=" 006032158c8b40e5a50120c8754703ae "/>
650) this.width=650; "src=" http://note.youdao.com/yws/res/8195/7FAE84826CE047E086C9BCD367570E33 "style=" Margin-top:8px;width:480px;height:auto; "alt=" 7fae84826ce047e086c9bcd367570e33 "/>
2. After you have created the physical volume for multiple hard disks, click Create Select Volume Group-Create a volume group as needed to specify the PE size
650) this.width=650; "src=" http://note.youdao.com/yws/res/8223/621AA389FA144717B3A24B1738E1F334 "style=" Background-color:rgb (255,255,255); margin-top:8px;width:474px;height:auto; "Alt=" 621aa389fa144717b3a24b1738e1f334 "/>
3, create the LV, need to explain,/boot cannot be created on the LV, can only be on the physical disk partition. Create multiple LVs as needed and specify different mount points, such as/home/usr/var, and so on.
650) this.width=650; "src=" Http://note.youdao.com/yws/res/8199/95E99F6FBA7A45009252EFAB447CBFFE "style=" Margin-top:8px;line-height:1.5;width:476px;height:auto; "alt=" 95e99f6fba7a45009252efab447cbffe "/>
650) this.width=650; "src=" Http://note.youdao.com/yws/res/8243/B365C062A9064002B95866AF440CBE7D "style=" Background-color:rgb (255,255,255); margin-top:8px;width:471px;height:auto; "Alt=" B365c062a9064002b95866af440cbe7d "/>
4, the creation is complete.
650) this.width=650; "src=" http://note.youdao.com/yws/res/8239/0CC2972A43F048CFBF185FF2AEF1E530 "style=" Background-color:rgb (255,255,255); margin-top:8px;width:463px;height:auto; "Alt=" 0cc2972a43f048cfbf185ff2aef1e530 "/>
5, after logging in, you can view the partition through the disk utility, if you need to expand the volume group, LV, reduce the management needs to enter the command line mode, through Vgextend and other commands.
Install the system on a RAID partition, similar to installing the LV, you need to create the partition first, then set the partition to the specified raid, and connect the mount point to the raid.
。 650) this.width=650; "src=" Http://note.youdao.com/yws/res/8207/F80E16E79CED40B693A2C777C89842C7 "style=" Margin-top:8px;line-height:1.5;width:458px;height:auto; "alt=" F80e16e79ced40b693a2c777c89842c7 "/>
The Disk usage tool allows you to create hot spares, delete RAID disks, replace new disks, and more.
650) this.width=650; "src=" http://note.youdao.com/yws/res/8255/746E09134B4B44B6AF13E31BE20948D9 "style=" Background-color:rgb (255,255,255); margin-top:8px;width:473.99999999999994px;height:auto; "Alt=" 746e09134b4b44b6af13e31be20948d9 "/>
650) this.width=650; "src=" Http://note.youdao.com/yws/res/8176/CE1490AA22F24EBD83BB0AD6D11C10DD "style=" Margin-top:8px;line-height:1.5;height:auto; "alt=" Ce1490aa22f24ebd83bb0ad6d11c10dd "/>
Yum for CD-ROM installation software
1. Modify the Yum configuration file:/etc/yum.repos.d/rhel-source.repo
Local Source: enabled=1
2. List all yum sources: Yum repolist
3. Install the software Yum list |grep LVM
Yum Install software name
This article is from the "direction without this" blog, please be sure to keep this source http://137783.blog.51cto.com/127783/1895566
Iv. Linux platform raid and LVM management