Installing Debian/Ubuntu on an Existing RAID/LVM
I like to test all the possible scenarios before putting a server into production. One of these tests was whether I could reinstall linux without disturbing the RAID arrays. Unfortunately the Debian and Ubuntu installers do not make this easy. When you reach the partitioning stage it will just show you the physical drives with the linux raid partitions and not the md devices. Here are the steps that worked for me.
When starting the installer proceed until you reach the network configuration screen where it asks for the hostname. At this point you’ll want to switch to another virtual terminal (alt+f2). Run the following commands
modprobe raid1 modprobe dm_mod mdrun |
Mdrun might return command not found as it has been depreciated in later linux releases. Don’t worry we can use mdadm instead.
mdadm --examine --scan --config=partitions > /tmp/mdadm.conf mdadm --assemble --scan --config=/tmp/mdadm.conf |
Let’s verify that the RAID arrays were found and started.
cat /proc/mdstat |
If you are using LVM we can now scan and activate the volumes.
lvscan
vgchange -a y |
Now you can return to the installer with alt+f1. When you reach the partitioning stage select manual and assign the RAID / LVM volumes mount points.