Introduction
The operating system of our servers is always running on a RAID-1 (either hardware or software RAID) for redundancy reasons. Since Proxmox VE 7 does not offer out-of-the-box support for mdraid (there is support for ZFS RAID-1, though), I had to come up with a solution to migrate the base installation to an mdraid RAID-1 and thought this might be useful for others as well. Therefore, I am sharing this as a howto here.
High-level explanation
Basically, I install PVE7 on
Step-by-step instructions
The operating system of our servers is always running on a RAID-1 (either hardware or software RAID) for redundancy reasons. Since Proxmox VE 7 does not offer out-of-the-box support for mdraid (there is support for ZFS RAID-1, though), I had to come up with a solution to migrate the base installation to an mdraid RAID-1 and thought this might be useful for others as well. Therefore, I am sharing this as a howto here.
High-level explanation
Basically, I install PVE7 on
/dev/sda
, then create a degraded(!) software RAID-1 on /dev/sdb3
, move the existing PV from /dev/sda3
to /dev/md0
and then join the mdraid /dev/md0
consisting only of /dev/sdb3
at first with /dev/sda3
.Step-by-step instructions
Code:
# Install mdadm
apt install mdadm
# Create identical partition layout to /dev/sda on /dev/sdb without copying labels/UUIDs
sfdisk -d /dev/sda > part_table
grep -v ^label-id part_table | sed -e 's/, *uuid=[0-9A-F-]*//' | sfdisk /dev/sdb
# Create a degraded RAID-1 on /dev/sdb3
mdadm --create /dev/md0 --level 1 --raid-devices 2 /dev/sdb3 missing
# Create LVM PV and add to existing VG
pvcreate /dev/md0
vgextend /dev/pve /dev/md0
# Move data from /dev/sda3 to /dev/md0
pvmove /dev/sda3 /dev/md0
# IMPORTANT! Wait for the process to finish, then remove /dev/sda3 from the VG
vgreduce /dev/pve /dev/sda3
# Add /dev/sda3 to RAID-1
mdadm --manage --add /dev/md0 /dev/sda3
# Byte copy EFI and BIOS boot partitions
dd if=/dev/sda1 of=/dev/sdb1
dd if=/dev/sda2 of=/dev/sdb2
# Install GRUB on all disks
grub-install /dev/sda
grub-install /dev/sdb
# Update initramfs
update-initramfs -u -k all
# Wait for RAID-1 sync to finish
watch cat /proc/mdstat