Linux – Install debian 8 on a LVM Volume with Type RAID1 GRUB2 cant find volume group

bootdebiangrub2linuxlvm

Hello Community!

I tried the whole day long to setup up an LVM type Raid1
Volume on Debian 8.5, but the Server is not be able to
boot from it.

First of all here is the error i get from GRUB2:

GRUB2

lvm lvs & lvm pvs

here are the steps i made, first i boot into grml (a Live-CD/Rescue-System): (factory new /dev/sda & /dev/sdb )

1 . then i create the partitions on both drives:

  • 512M Primary (Linux raid autodetect)
  • 20G Primary 8e (Linux LVM)

2. now i create the Raid for my /boot and format as ext4

  • mdadm –create /dev/md0 –level=1 –raid-disks=2 /dev/sda1 /dev/sdb1
  • mkfs.ext4 /dev/md0

3. its time for the volume group

pvcreate /dev/sda2
pvcreate /dev/sdb2
vgcreate vg0 /dev/sda2 /dev/sdb2

4. we come to the volumes and format them

lvcreate -n root -L 20G vg0 --type raid1
lvcreate -n swap -L 4G vg0 --type raid1

root@grml ~ # lvscan
ACTIVE '/dev/vg0/root' [10,00 GiB] inherit
ACTIVE '/dev/vg0/swap' [4,00 GiB] inherit

mkfs.ext4 /dev/vg0/root mkswap /dev/vg0/swap

5. mount the volumes

mount /dev/vg0/root /mnt
cd /mnt
mkdir boot
mkdir proc
mkdir dev
mkdir sys
mkdir home
mount /dev/md0 boot/

  1. create fstab

mkdir etc
cd etc
vi fstab

`proc /proc   proc   defaults 0 0
/dev/md0 /boot   ext4   defaults 0 2
/dev/vg0/root /              ext4   defaults 0 1
/dev/vg0/swap          none      swap  defaults,pri=1 0 0`

7. debootstrap debian jessie

debootstrap --arch amd64 jessie /mnt ftp://ftp.de.debian.org/debian/

8. mount some essentials

mount -t proc none /mnt/proc
mount -o bind /dev /mnt/dev
mount -o bind /sys /mnt/sys

9. chroot into the shiny new debian

chroot /mnt /bin/bash

10. set a new root password
passwd

11. add contrib & non-free to the sourcelist

nano /etc/apt/sources.list

deb http://ftp.de.debian.org/debian jessie main contrib non-free

12. install packages

apt-get install mdadm openssh-server lvm2 locales ntp vim-nox firmware-realtek

13. configure locales

dpkg-reconfigure locales tzdata

14. install the kernel

apt-get install linux-image-amd64

15. grub2
apt-get install grub2

selecting sda & sdb as install devices

grub-install --no-floppy /dev/sda
grub-install --no-floppy /dev/sdb
update-grub /dev/md0
update-initramfs -u

16. exit and reboot

exit
shutdown -r now

maybe any body can help me, i hope i only forget something.

Best Answer

According to Redhat staff:

Grub doesn't support LVM RAID1 (it supports only RAID 4/5/6 type IIRC).

Debian 8 has some old interior, you could hit the same limitation, I wanted to find some official info about Grub's limitations, unfortunately I've failed.

Re: [linux-lvm] GRUB boot problem with lvm mirror type raid1

From: Peter Rajnoha <prajnoha redhat com>
To: gk180984 interia pl
Cc: LVM general discussion and development <linux-lvm redhat com>
Subject: Re: [linux-lvm] GRUB boot problem with lvm mirror type raid1
Date: Mon, 14 Apr 2014 11:40:36 +0200
On 04/14/2014 10:42 AM, gk180984 interia pl wrote:
Hi
I want to ask it is possible boot root file system (via GRUB) from LVM
RAID1 volume?
I can boot root file system (with /boot) from linera LVM volume and
from mirror volume, but when I create raid1 mirror GRUB can't boot from it:

lvconvert --type raid1 -m1 gsys/vsys

LVM mirror is work:
lvconvert -m1 gsys/vsys

I have two disk and use only LVM, not other raid software.
GRUB have lvm module.
Grub doesn't support LVM RAID1 (it supports only RAID 4/5/6 type IIRC).

However, I don't recommend using /boot on LVM at the moment since
grub support for LVM is limited and unofficial. There's a plan to add
official and more robust support though - there are ongoing discussions
between grub and LVM team...