LVM mirror

Henning Fehrmann henning.fehrmann at aei.mpg.de
Tue Mar 21 17:12:15 CET 2023


Hello,

we intend to install the OS on a LVM which is put on top of two mirrored
physical devices without using mdadm. We use FAI v 5.10.3.

The standard disk_config:

```
disk_config disk1 disklabel:gpt-bios fstabkey:uuid
primary     -     1-             -       -

disk_config disk2 sameas:disk1

disk_config lvm

vg os disk1.1
os-root       /      30G-    xfs    defaults
```

yields:

```
DRY-RUN pvcreate -ff -y  /dev/sda1
DRY-RUN vgcreate  os  /dev/sda1
DRY-RUN vgchange -a y os
DRY-RUN lvcreate  --yes -n root -L 59808.8540478516 os
```

I can attach a second disk for pvcreate with

vg os disk1.1 pvcreateopts="/dev/sdb1"

but this is already cheating since disk2.1 should be used instead.

There is no way to attach the second disk to vgcreate since any option appears
before the volume group name. E.g.:

vg os disk1.1 pvcreateopts="/dev/sdb1" vgcreateopts="/dev/sdb1"

leads to:

```
DRY-RUN pvcreate -ff -y /dev/sdb1 /dev/sda1
DRY-RUN vgcreate /dev/sdb1 os  /dev/sda1
```

which won't work.

I can't add lvcreateopts, e.g.:

vg os disk1.1 pvcreateopts="/dev/sdb1" vgcreateopts="/dev/sdb1" lvcreateopts="--type raid1 -m 1"

gives:
      ERROR (line 12): Invalid line: Was expecting '\n' but found "vg os
                       disk1.1 pvcreateopts="/dev/sdb1"
                       vgcreateopts="/dev/sdb1" lvcreateopts="--type raid 1 -m
                       1"" instead


I haven't looked into the scripts, but seems that mirroring via LVM is not yet
included or have I missed something?

Should I create a hook to achieve this or should I better opt for a more recent
FAI version?

Thank you,
Henning


More information about the linux-fai mailing list