Create an LVM software RAID level 1 (raid1)

Caution

This feature is available as Technology Preview. Use such configuration for testing and evaluation purposes only. For the Technology Preview feature definition, refer to Technology Preview support scope.

During configuration of your custom bare metal host profile, you can create an LVM-based software RAID device raid1 by adding type: raid1 to the logicalVolume spec in BaremetalHostProfile.

Caution

The logicalVolume spec of the raid1 type requires at least two devices (partitions) in volumeGroup where you build a logical volume. For an LVM of the linear type, one device is enough.

Note

The LVM raid1 requires additional space to store the raid1 metadata on a volume group, roughly 4 MB for each partition. Therefore, you cannot create a logical volume of exactly the same size as the partitions it works on.

For example, if you have two partitions of 10 GiB, the corresponding raid1 logical volume size will be less than 10 GiB. For that reason, you can either set sizeGiB: 0 to use all available space on the volume group, or set a smaller size than the partition size. For example, use sizeGiB: 9.9 instead of sizeGiB: 10 for the logical volume.

The following example illustrates an extract of BaremetalHostProfile with / on the LVM raid1.

...
devices:
  - device:
      byName: /dev/sda
      minSizeGiB: 200
      type: hdd
      wipe: true
    partitions:
      - name: root_part1
        sizeGiB: 120
    partitions:
      - name: rest_sda
        sizeGiB: 0
  - device:
      byName: /dev/sdb
      minSizeGiB: 200
      type: hdd
      wipe: true
    partitions:
      - name: root_part2
        sizeGiB: 120
    partitions:
      - name: rest_sdb
        sizeGiB: 0
volumeGroups:
  - name: vg-root
    devices:
      - partition: root_part1
      - partition: root_part2
  - name: vg-data
    devices:
      - partition: rest_sda
      - partition: rest_sdb
logicalVolumes:
  - name: root
    type: raid1  ## <-- LVM raid1
    vg: vg-root
    sizeGiB: 119.9
  - name: data
    type: linear
    vg: vg-data
    sizeGiB: 0
fileSystems:
  - fileSystem: ext4
    logicalVolume: root
    mountPoint: /
    mountOpts: "noatime,nodiratime"
  - fileSystem: ext4
    logicalVolume: data
    mountPoint: /mnt/data