2017年4月25日 星期二

RHEL 7.2 - dracut unable to assemble(boot) from a degraded raid1 array

問題:

Reproduce:
1. 組一個/dev/md0 is a RAID1 made of /dev/sda /dev/sdb,
mdid:5068eccc:e5b86ea8:be8fe496:61ee1fd8
blkid:21df6a4c-bce3-4fe4-8739-8e804f4893dd

2. 把/dev/dm0放在kernel boot parameter,
/boot/grub2/grub.conf :linux16 kernel .. rd.md.uuid=5068eccc:e5b86ea8:be8fe496:61ee1fd8

3. shutdown, unplug /dev/sdb
4. power on, cat /proc/mdstat --> /dev/md0 is inactive. If you configure /dev/md0 as /boot, or / partition in /etc/fstab, you will enter "user intervention" mode, because /dev/md0 can't be mounted.
5. you need to run "mdadm --run /dev/md0" manually to assemble /dev/md0 and reboot successfully.

Conclusion:
Entering "user intervention" mode is correct behavior when we have a degraded raid.

Root cause:
dracut don't assemble the degraded raid unless you configure "hostonly_cmdline" in /usr/lib/dracut/dracut.conf.d/01-dist.conf and re-generate initramfs by executing "dracut -f".
1. when you configure "hostonly_cmdline=yes", we can find 90mdraid.conf under the re-generated $initramfs/etc/cmdline.d
2. $dracut/modules.d/99base/dracut-lib.sh
 135     for _i in /etc/cmdline.d/*.conf; do
 136         [ -e "$_i" ] || continue
 137         while read -r _line || [ -n "$_line" ]; do
 138             CMDLINE_ETC_D="$CMDLINE_ETC_D $_line";
 139         done <"$_i";
 140     done

hostonly_cmdline的意思是,把kernel parameter存到initramfs/etc/cmdline.d/底下,這樣dracut的機制會去retry在initramfs/etc/cmdline.d/* 裡面的device。可以打開/boot/grub2/grub.conf "rd.shell rd.debug"去追dracut怎麼跑

沒有留言:

張貼留言

kgdb

--0313-- ken 不好意思 请教一下 之前你有交过我 在没有coredump的情况下 可以用gdb直接载入ko.debug, 然后dis -l register_bcache, 我记得使用方式是不是这样, 不过我现在dis -l出现错误^^" [root@...