Linux

在類型為 RAID1 GRUB2 的 LVM 卷上安裝 debian 8 找不到卷組

  • July 11, 2016

你好社區!

我一整天都在嘗試在 Debian 8.5 上設置 LVM 類型的 Raid1 卷,但伺服器無法從它啟動。

首先是我從 GRUB2 得到的錯誤:

GRUB2

lvm lvs & lvm pvs

這是我所做的步驟,首先我啟動到 grml(Live-CD/Rescue-System):(工廠新 /dev/sda & /dev/sdb)

1. 然後我在兩個驅動器上創建分區:

  • 512M 主要(Linux RAID 自動檢測)
  • 20G 主 8e (Linux LVM)

2. 現在我為我的 /boot 創建 Raid 並格式化為 ext4

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

3. 卷組時間

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

4. 我們來到卷並格式化它們

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 /dev/vg0/root /mnt cd /mnt mkdir boot mkdir proc mkdir dev mkdir sys mkdir home mount /dev/md0 boot/

  1. 創建 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 -t proc none /mnt/proc mount -o bind /dev /mnt/dev mount -o bind /sys /mnt/sys

9. chroot 進入閃亮的新 debian

chroot /mnt /bin/bash

10.設置新的root密碼 passwd

11. 將 contrib 和 non-free 添加到 sourcelist

nano /etc/apt/sources.list

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

12.安裝包

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

13.配置語言環境

dpkg-reconfigure locales tzdata

14.安裝核心

apt-get install linux-image-amd64

15.grub2 apt-get install grub2

選擇 sda & sdb 作為安裝設備

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

16.退出並重啟

exit shutdown -r now

也許任何人都可以幫助我,我希望我只會忘記一些事情。

根據Redhat 工作人員的說法:

Grub 不支持 LVM RAID1(它只支持 RAID 4/5/6 類型 IIRC)

Debian 8 有一些舊的內部,你可能會遇到同樣的限制,我想找到一些關於 Grub 限制的官方資訊,不幸的是我失敗了。

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...

引用自:https://serverfault.com/questions/789017