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. --- liveinit | 46 +++++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 15 deletions(-) (limited to 'liveinit') 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." -- cgit v1.2.3