Raid

將 root 從 lvm2 轉換為 lvm2+raid1 (lvconvert –type raid1) 後出現“LV 狀態不可用”

  • May 7, 2013

我剛剛通過 lvm2 根文件系統從線性 lvm2(單個 HDD:sda)轉換為 lvm2 raid1(使用lvconvert -m1 --type raid1 /dev/ubuntu/root /dev/sdb5命令)。但是在此轉換之後,我無法啟動我的 ubuntu 12.10(核心 3.5.0-17-generic)。

Initramfs 說它在 /dev/mapper 中找不到 root fs:

Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
... (kernel messages)
Gave up waiting for root device.  Common problems:
- Boot args (cat /proc/cmdline)
  - Check rootdelay= (did the system wait long enough?)
  - Check root= (did the system wait for the right device?)
- Missing modules (cat /proc/modules; ls /dev)
ALERT!  /dev/mapper/ubuntu-root does not exist.  Dropping to a shell!

有我的模組和命令行列表:

(initramfs) cat /proc/modules
hid_generic
usbhid
hid
e1000
raid10
raid456
async_pq
async_xor
xor
async_memcpy
async_raid6_recov
raid6_pq
async_tx
raid1
raid0
multipath
linear
(initramfs) cat /proc/cmdline
BOOT_IMAGE=/vmlinux-3.5.0-17-generic root=/dev/mapper/ubuntu-root ro
(initramfs) ls /dev/mapper
control     ubuntu-swap_1

實用程序的輸出lvm表明根 LV 處於非活動狀態/不可用:

lvm> pvscan
 PV /dev/sda5    VG ubuntu   lvm2 [ 13.76 GiB / 408.00 MiB free]
 PV /dev/sdb5    VG ubuntu   lvm2 [ 13.76 GiB / 508.00 MiB free]
lvm> vgscan
 Reading all physical volumes. This may take a while...
 Found volume group "ubuntu" using metadata type lvm2
lvm> lvscan
 inactive        '/dev/ubuntu/root' [13.26 GiB] inherit
 ACTIVE          '/dev/ubuntu/swap_1' [100.00 MiB] inherit

lvm> lvdisplay ubuntu
 --- Logical volume ---
 LV Path                /dev/ubuntu/root
 LV Name                root
 VG Name                ubuntu
 LV UUID                xxxxxxxxxxxxxxx
 LV Write Access        read/write
 LV Creation host, time ubuntu, 2013-05-07
 LV Status              NOT available          <<<<< !!!!
 LV Size                13.26 GB
 Current LE             3394
 Mirrored volumes       2
 Segments               1
 Allocation             inherit
 Read ahead sectors     auto

在我lvchange -ay ubuntu的情況下,從 initrd 失敗:

lvm>  lvchange -ay ubuntu
 /sbin/modprobe failed: 1
 Can't process LV root: raid1 target support missing from kernel?

我的 initrd 中缺少哪個模組?現在我從這個核心中收集了完整的模組,並且可以嘗試任何模組。

你需要這個:

modprobe dm_raid

{pv,vg,lv}scan查看磁碟並查看那裡的LV。但是由於核心無法以配置的方式提供對它們的訪問,因此它們無法訪問。

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