所以我设法最终解决了这个问题。检测逻辑卷存在一个问题(错误),这是某种竞争条件(在我看来,这可能是在KVM内部发生的事实)。在下面的讨论中将对此进行介绍。在我的特殊情况下(Debian Squeeze),解决方案如下:
- 备份脚本/ usr / share / initramfs-tools / scripts / local-top / lvm2
- 应用提到的错误报告中的补丁
- 运行update-initramfs -u
这对我有所帮助,希望对其他人有所帮助(奇怪的是,这还不是主流)。
修补程序链接:_http://bugs.debian.org/cgi-bin/bugreport.cgi?msg = 10;文件名= lvm2_wait-lvm.patch; att = 1; bug = 568838
以下是后代的副本。
--- /usr/share/initramfs-tools/scripts/local-top/lvm2 2009-08-17 19:28:09.000000000 +0200
+++ /usr/share/initramfs-tools/scripts/local-top/lvm2 2010-02-19 23:22:14.000000000 +0100
@@ -45,12 +45,30 @@
eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev")
- if [ "$DM_VG_NAME" ] && [ "$DM_LV_NAME" ]; then
- lvm lvchange -aly --ignorelockingfailure "$DM_VG_NAME/$DM_LV_NAME"
- rc=$?
- if [ $rc = 5 ]; then
- echo "Unable to find LVM volume $DM_VG_NAME/$DM_LV_NAME"
- fi
+ # Make sure that we have non-empty volume group and logical volume
+ if [ -z "$DM_VG_NAME" ] || [ -z "$DM_LV_NAME" ]; then
+ return 1
+ fi
+
+ # If the logical volume hasn't shown up yet, give it a little while
+ # to deal with LVM on removable devices (inspired from scripts/local)
+ fulldev="/dev/$DM_VG_NAME/$DM_LV_NAME"
+ if [ -z "`lvm lvscan -a --ignorelockingfailure |grep $fulldev`" ]; then
+ # Use default root delay
+ slumber=$(( ${ROOTDELAY:-180} * 10 ))
+
+ while [ -z "`lvm lvscan -a --ignorelockingfailure |grep $fulldev`" ]; do
+ /bin/sleep 0.1
+ slumber=$(( ${slumber} - 1 ))
+ [ ${slumber} -gt 0 ] || break
+ done
+ fi
+
+ # Activate logical volume
+ lvm lvchange -aly --ignorelockingfailure "$DM_VG_NAME/$DM_LV_NAME"
+ rc=$?
+ if [ $rc = 5 ]; then
+ echo "Unable to find LVM volume $DM_VG_NAME/$DM_LV_NAME"
fi
}