diff options
author | Benjamin Albrecht <[email protected]> | 2015-11-20 17:48:54 +0100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2015-12-18 13:46:23 -0800 |
commit | 82dba185c8780e439958d1524f91167a2920d76c (patch) | |
tree | e26581ba517dbaa5c03ce8cbeb63d47f483be6bc /contrib/initramfs/scripts | |
parent | 6b4e21c60eda9d9e514c933de7cbe214aa77f7f4 (diff) |
Activate LVM volume groups before looking for zpools.
Original-patch-by: @jgoerzen
Signed-off-by: Benjamin Albrecht <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes zfsonlinux/pkg-zfs#102
Closes #4029
Diffstat (limited to 'contrib/initramfs/scripts')
-rwxr-xr-x | contrib/initramfs/scripts/local-top/zfs | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/contrib/initramfs/scripts/local-top/zfs b/contrib/initramfs/scripts/local-top/zfs new file mode 100755 index 000000000..f09b2c81b --- /dev/null +++ b/contrib/initramfs/scripts/local-top/zfs @@ -0,0 +1,60 @@ +#!/bin/sh +PREREQ="mdadm mdrun multipath" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + + +# +# Helper functions +# +message() +{ + if [ -x /bin/plymouth ] && plymouth --ping; then + plymouth message --text="$@" + else + echo "$@" >&2 + fi + return 0 +} + +udev_settle() +{ + # Wait for udev to be ready, see https://launchpad.net/bugs/85640 + if [ -x /sbin/udevadm ]; then + /sbin/udevadm settle --timeout=30 + elif [ -x /sbin/udevsettle ]; then + /sbin/udevsettle --timeout=30 + fi + return 0 +} + + +activate_vg() +{ + # Sanity checks + if [ ! -x /sbin/lvm ]; then + message "lvm is not available" + return 1 + fi + + # Detect and activate available volume groups + /sbin/lvm vgscan + /sbin/lvm vgchange -a y --sysinit + return $? +} + +udev_settle +activate_vg + +exit 0 |