Create LVM partitions using RAID

Source: Internet
Author: User
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.

Related Article

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.