From fac61b4362d164bcc70250782c87b02c54dacd04 Mon Sep 17 00:00:00 2001 From: John Lane Date: Wed, 17 Dec 2014 12:13:21 +0000 Subject: [PATCH] Activate LVM logical volumes when possible When the root volume is a logical volume on LVM that is part of a volume group containing multiple physical volumes, it won't be activated until all those physical volumes are online. In cases where only the pv containing root is available, do an explicit activation as long as the required logical volume is healthy (i.e. it must be wholly located on the available physical volume). --- init_functions | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/init_functions b/init_functions index 11ce3ca..85d4486 100644 --- a/init_functions +++ b/init_functions @@ -41,6 +41,16 @@ poll_device() { sleepinterval=$(( sleepinterval * 2 )) fi done + + if [ "${device#/dev/mapper/*}" != "${device}" ]; then + if [ -x /bin/lvm -a ! -b "$device" ]; then + lvm_attributes=$(lvm lvs -o attr "$device" 2>/dev/null | tail -1) + if [ "${lvm_attributes:10:1}" == '-' ]; then + lvm lvchange -ay "$device" >/dev/null 2>&1 + fi + fi + fi + fi [ -b "$device" ] -- 2.1.2