Create a RAID logical volume

RAID logical volumes enable you to use multiple disks for redundancy and performance. LVM supports various RAID levels, including RAID0, RAID1, RAID4, RAID5, RAID6, and RAID10.

Before you begin

  • Administrative access.

About this task

With LVM you can create striped RAIDs (RAID0, RAID4, RAID5, RAID6), mirrored RAID (RAID1), or a combination of both (RAID10). RAID 4, RAID 5, and RAID 6 offer fault tolerance by storing parity data that you can use to reconstruct lost information in case of a disk failure.

When creating RAID LVs, place each stripe on a separate PV. The number of stripes equals to the number of PVs that should be in the volume group (VG).

Table 1. Minimal RAID configuration requirements
RAID level Type Parity Minimum number of devices Minimum stripe number

RAID0

Striping

None

2

2

RAID1

Mirroring

None

2

-

RAID4

Striping

Uses first device to store parity

3

2

RAID5

Striping

Uses an extra device to store parity

3

2

RAID6

Striping

Uses two extra devices to store parity

5

3

RAID10

Striping and mirroring

None

4

2

Procedure

  1. List the names of volume groups and their size:
    # vgs -o vg_name,vg_size
      VG              VSize
      VolumeGroupName 30.75g
  2. Create a RAID LV:
    • To create a striped raid, use:
      # lvcreate --type raidlevel --stripes NumberOfStripes --stripesize StripeSize --size Size --name LogicalVolumeName VolumeGroupName

      Replace level with the RAID level 0, 4, 5, or 6. Replace NumberOfStripes with the number of stripes. Replace StripeSize with the stripe size in kilobytes. Replace Size with the size of the LV. Replace LogicalVolumeName with the name of the LV.

    • To create a mirrored RAID, use:
      # lvcreate --type raid1 --mirrors MirrorsNumber --size Size --name LogicalVolumeName VolumeGroupName

      Replace MirrorsNumber with the number of mirrors. Replace Size with the size of the LV. Replace LogicalVolumeName with the name of the LV.

    • To create a mirrored and striped RAID, use:
      # lvcreate --type raid10 --mirrors MirrorsNumber --stripes NumberOfStripes --stripesize StripeSize --size Size --name LogicalVolumeName VolumeGroupName

      Replace MirrorsNumber with the number of mirrors. Replace NumberOfStripes with the number of stripes. Replace StripeSize with the stripe size in kilobytes. Replace Size with the size of the LV. Replace LogicalVolumeName with the name of the LV.

Results

  • Verify that the RAID LV is created:
    # lvs -o lv_name,seg_type
      LV                   Type
      LogicalVolumeName    raid0