LVM on RAID with preserve_reinstall
Erik Meitner
emeitner at math.wisc.edu
Tue Nov 7 21:37:51 CET 2023
I was able to get this to work. My notes are below.
---
To get this to work you need to set up some things.
First, create hooks/partition.FLAG_LVM_ON_MD:
#!/bin/bash
modprobe md
/usr/share/mdadm/mkconf > /tmp/md
mdadm --assemble --scan -c /tmp/md
Make sure to "chmod 755 hooks/partition.FLAG_LVM_ON_MD"
Then add the machine to the FLAG_LVM_ON_MD class using some
manual method of your choice.
Set up $NFSROOT/etc/udev/rules.d/69-lvm-metad.rules according to this:
https://lists.uni-koeln.de/pipermail/linux-fai/2022-September/012893.html
This may change if the nfsroot gets upgraded beyond Debian Bullseye.
Copy $NFSROOT/lib/udev/rules.d/69-lvm-metad.rules into /etc/udev/rules.d/
and applied the following patch.
PATCH:
---
/srv/fai/nfsroot/bullseye-amd64/etc/udev/rules.d/69-lvm-metad.rules.orig
2021-02-22 13:39:14.000000000 -0800
+++ /srv/fai/nfsroot/bullseye-amd64/etc/udev/rules.d/69-lvm-metad.rules
2022-09-01 19:22:52.426117170 -0700
@@ -75,8 +75,7 @@
ENV{SYSTEMD_READY}="1"
-TEST!="/run/systemd/system", GOTO="direct_pvscan"
-TEST=="/run/systemd/system", GOTO="systemd_background"
+GOTO="systemd_background"
LABEL="systemd_background"
/PATCH
IMPORTANT:
For the initial set up of the machine you must create
class/{MACHINENAME}.var which contains:
flag_initial=1
Comment that line out when setup is done
disk_config/lvm-on-on-example:
disk_config disk1 bootable:1 align-at:1M preserve_reinstall:2
primary /boot 100M ext4 rw,relatime
primary - 10G - -
disk_config disk2 bootable:1 align-at:1M preserve_reinstall:2
primary - 100M ext4 rw,relatime
primary - 10G - -
disk_config raid fstabkey:uuid preserve_reinstall:0
raid1 - disk1.2,disk2.2 - -
disk_config lvm fstabkey:uuid
vg vg_system md0
vg_system-swap swap 50M swap sw,pri=0
vg_system-data /data 50M:preserve_reinstall ext4
rw,relatime createopts="-FL DATA"
vg_system-root / 500M- ext4
rw,relatime createopts="-FL ROOTFS"
On 11/7/23 10:49, Erik Meitner wrote:
> What is the status of using preserve_reinstall on LVM volumes that use
> md devices for their PV?
>
> When flag_initial=1 and I am re-installing the machine(a test VM in
> this case) FAI does not activate the md devices so the LVM volumes are
> never found. FAI reports "Can't preserve /dev/vg_data/data because it
> does not exist"
>
> For some reason FAI is not activating the raid devices
>
> Thanks.
>
>
> disk_config disk1 bootable:1 align-at:1M preserve_reinstall:1,3
> primary /boot 100M ext4 rw,relatime
> primary - 10G - -
> primary - 20G- - -
>
> disk_config disk2 bootable:1 align-at:1M preserve_reinstall:1,3
> primary - 100M ext4 rw,relatime
> primary - 10G - -
> primary - 20G- - -
>
> disk_config raid fstabkey:uuid preserve_reinstall:1
> raid1 - disk1.2,disk2.2 - -
> raid1 - disk1.3,disk2.3 - -
>
> disk_config lvm fstabkey:uuid
> vg vg_system md0
> vg_system-swap swap 50M swap sw,pri=0
> vg_system-root / 500M- ext4
> rw,relatime createopts="-FL ROOTFS"
>
> disk_config lvm fstabkey:uuid
> vg vg_data md1
> vg_data-data /data 50M:preserve_reinstall ext4
> rw,relatime createopts="-FL DATA"
>
>
--
Erik Meitner
Linux Systems Administrator
Math Department
UW-Madison
480 Lincoln Drive
507 Van Vleck Hall
Madison, WI 53706
608-263-4189
emeitner at math.wisc.edu
GPG Public key is on keys.openpgp.org
More information about the linux-fai
mailing list