Because the LVM can elastically adjust the file system size, the disadvantage is that it may not be capable of acceleration and hardware backup (unlike snapshot. Disk arrays provide performance and backup functions, but cannot provide advantages similar to LVM. In this situation, we want to build LVM functions on RAID to achieve both capabilities. Lab environment: VMware operations
Because the LVM can elastically adjust the file system size, the disadvantage is that it may not be capable of acceleration and hardware backup (unlike snapshot. Disk arrays provide performance and backup functions, but cannot provide advantages similar to LVM. In this situation, we want to build LVM functions on RAID to achieve both capabilities.
Lab environment: VMware
Operating system: RHEL5.4
Tutorial steps:
1. add several disks to the virtual machine (four additional disks are sdb, sdc, sdd, and sde in this experiment ).
Mdadm -- create -- auto = yes/dev/md0 -- level = 5 -- raid-devices = 3 -- spare-devices = 1/dev/sd {B, c, d, e}
Note: During the construction, the entire disk is not partitioned for each disk. The purpose is to simplify the process.
2. format the disk array:
Mkfs-t ext3/dev/md0
3. as mentioned in the previous article, use pvcreate to create a PV (t physical volume) and vgcreate to create a VG group:
Pvcreate/dev/md0
Vgcreate raidvg/dev/md0
4. use vgdisplay to view the details of the VG group, as shown in:
5. create a new LV (logical volume) using the previous command lvcreate)
Lvcreate-l 2071-n raidlv raidvg
Lvcreate-l 500-n raidlv2 raidvg
6. use lvdisplay to view the detailed information of the two created LV
7. LV is created successfully, formatted, and set the mount point (take one of them as an example)
Mkfs-t ext3/dev/raidvg/raidlv2
Mkdir/mnt/raidlv2
Mount/dev/raidvg/raidlv2/mnt/raidlv2
8. now we can use the newly mounted raid LV2, and use df-h to view the overall disk usage of the file system. For example:
9. after the test is completed, make sure to close the information created in this question.
Lvremove/dev/raidvg/raidlv2
Vgchange-a n raidvg makes the VG group inactive
Pvremove/dev/md0
Mdadm -- stop/dev/md0
10. some readers may ask, can the LVM created through RAID be expanded and reduced like a basic disk?
Personal opinion: Yes, but there are some restrictions. for example, after creating a RAID disk array and adding another disk to expand the RAID, it is still a problem for me (a lot of research, after this is done, we will share it with you). you can only reserve some PE blocks for LV capacity expansion when creating lv.
Based on the content of the previous article, you can expand the LV capacity by yourself. Pai_^
You must remember to support the on-line mode during expansion, but you must uninstall the file system before you perform operations on it.