From 914f14494c50721868e02889e332b5c6a6e9e4ba Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Wed, 17 Feb 2016 13:04:46 +0100 Subject: New boot parameter "localhd" to initialize RAID/LVM on local harddisks. --- EFI/BOOT/help.txt | 2 ++ liveinit | 46 +++++++++++++++++++++++++++++++--------------- syslinux/f4.txt | 2 ++ 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/EFI/BOOT/help.txt b/EFI/BOOT/help.txt index ecc3b76..3609f98 100644 --- a/EFI/BOOT/help.txt +++ b/EFI/BOOT/help.txt @@ -31,6 +31,8 @@ noload=mod1[,mod2[...]] => Prevent loading of one or more === Hardware related === +localhd => initialize RAID/LVM on local hard drives. + nomodeset => Boot without kernel mode setting, needed with some machines. diff --git a/liveinit b/liveinit index 9ec6fef..d8c5945 100755 --- a/liveinit +++ b/liveinit @@ -53,6 +53,9 @@ DEBUG=0 # Masochists can copy the live environment into RAM: TORAM=0 +# By default we do not touch local hard disks (raid, lvm, btrfs): +LOCALHD=0 + # Perhaps we need to blacklist some kernel module(s): BLACKLIST="" @@ -113,6 +116,9 @@ for ARG in $(cat /proc/cmdline); do locale=*) LOCALE=$(echo $ARG | cut -f2 -d=) ;; + localhd=*) + LOCALHD=1 + ;; luksvol=*) # Format: luksvol=file1[:/mountpoint1][,file1[:/mountpoint2],...] LUKSVOL=$(echo $ARG | cut -f2 -d=) @@ -203,22 +209,32 @@ if [ -n "$KEYMAP" ]; then fi if [ "$RESCUE" = "" ]; then - # Initialize RAID: - if [ -x /sbin/mdadm ]; then - # If /etc/mdadm.conf is present, udev should DTRT on its own; - # If not, we'll make one and go from there: - if [ ! -r /etc/mdadm.conf ]; then - /sbin/mdadm -E -s >/etc/mdadm.conf - /sbin/mdadm -S -s - /sbin/mdadm -A -s - # This seems to make the kernel see partitions more reliably: - fdisk -l /dev/md* 1> /dev/null 2> /dev/null + if [ $LOCALHD -eq 1 ]; then + # We will initialize RAID/LVM/BTRFS on local harddisks: + # Initialize RAID: + if [ -x /sbin/mdadm ]; then + # If /etc/mdadm.conf is present, udev should DTRT on its own; + # If not, we'll make one and go from there: + if [ ! -r /etc/mdadm.conf ]; then + /sbin/mdadm -E -s >/etc/mdadm.conf + /sbin/mdadm -S -s + /sbin/mdadm -A -s + # This seems to make the kernel see partitions more reliably: + fdisk -l /dev/md* 1> /dev/null 2> /dev/null + fi fi - fi - # Scan for btrfs multi-device filesystems: - if [ -x /sbin/btrfs ]; then - /sbin/btrfs device scan + # Initialize LVM: + if [ -x /sbin/vgchange ]; then + mkdir -p /var/lock/lvm # this avoids useless warnings + /sbin/vgchange -ay --ignorelockingfailure 2>/dev/null + /sbin/udevadm settle --timeout=10 + fi + + # Scan for btrfs multi-device filesystems: + if [ -x /sbin/btrfs ]; then + /sbin/btrfs device scan + fi fi # --------------------------------------------------------------------- # @@ -680,7 +696,7 @@ EOPW # Switch to real root partition: /sbin/udevadm settle --timeout=10 echo 0x0100 > /proc/sys/kernel/real-root-dev - + if [ ! -r /mnt/overlay/${INIT} ]; then echo "ERROR: No ${INIT} found on rootdev (or not mounted). Trouble ahead." echo " You can try to fix it. Type 'exit' when things are done." diff --git a/syslinux/f4.txt b/syslinux/f4.txt index 3a871e3..7aba387 100644 --- a/syslinux/f4.txt +++ b/syslinux/f4.txt @@ -2,6 +2,8 @@ === Hardware related === +localhd => initialize RAID/LVM on local hard drives. + nomodeset => Boot without kernel mode setting, needed with some machines. -- cgit v1.2.3