How to enable degraded RAID1 boot in 16.04LTS?

11,975

Solution 1

The mentioned bug appears in mdadm 3.3-2ubuntu7 and has been fixed in 3.4-2.

The latest mdadm release for yakkety (16.10) 3.4-4 contains the fix already and is available for 16.10 but not (yet?) for 16.04LTS.

Thus I upgraded mdadm of my 16.04LTS by hand:

wget http://launchpadlibrarian.net/275652884/mdadm_3.4-4_amd64.deb
sudo dpkg -i mdadm_3.4-4_amd64.deb

To verify I

  • shut down the computer
  • unplugged one of the disks/ssd
  • Turn on the computer

Observing the console: Boot from degraded raid array works!

Bug: https://bugs.launchpad.net/ubuntu/+source/mdadm/+bug/1635049 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=784070

Solution 2

It seems that root cause is /usr/share/initramfs-tools/scripts/local-top/mdadm script absence - on Debian-8 it is included in mdadm package, but was lost in the same package for Ubuntu-16.04 ;-(

So, after I've created its dirty-hack version and recreated initramfs - my test Ubuntu-16.04 LTS server was able to fully boot using the only second HDD from RAID1 array.

#!/bin/sh
# 2016-07-13 [email protected] - missed mdadm script for Ubuntu-16.04
# see debian8_host:/usr/share/initramfs-tools/scripts/local-top/mdadm for full version

MDADM=/sbin/mdadm 
. /scripts/functions

echo "===>"
cat /proc/mdstat
echo "===>"
log_begin_msg "Assembling all MD arrays"
if $MDADM --assemble --scan --run --auto=yes
then
  log_success_msg "assembled all arrays."
else
  log_warning_msg "failed to assemble all arrays, attempting individual starts"
  for dev in $(cat /proc/mdstat | grep md | cut -d ' ' -f 1)
  do
    log_begin_msg "attempting mdadm --run $dev"
    if $MDADM --run $dev; then
      log_success_msg "started $dev"
    else
      log_failure_msg "failed to start $dev"
    fi
  done
fi
log_end_msg
echo "===>"
cat /proc/mdstat
echo "===>"

sleep 5

# TODO: run mdadm --readwrite /dev/mdN
# if array is in 'auto-read-only' mode
Share:
11,975

Related videos on Youtube

vdyvp
Author by

vdyvp

Updated on September 18, 2022

Comments

  • vdyvp
    vdyvp almost 2 years

    In previous ubuntu versions, adding BOOT_DEGRADED=true to /etc/initramfs-tools/conf.d/mdadm allowed the system to automatically boot when the root filesystem is on a degraded array. This no longer seems to work in 16.04 LTS.

    The documentation (https://help.ubuntu.com/lts/serverguide/advanced-installation.html) looks to be outdated; sudo dpkg-reconfigure mdadm no longer asks to allow degraded boots and the bootdegraded=true kernel argument also no longer seems to work. The system always boots into initramfs when the root filesystem array is degraded. From there,mdadm -IRs allows the system to boot.

    How do I enable automatic booting when the root filesystem is on a degraded RAID1 array in 16.04LTS?

    • Diego
      Diego over 5 years
      The actual configuration bug seems to be fixed but the documentation is still incorrect as per bugs.launchpad.net/serverguide/+bug/1310162 As far as I understood, no extra configuration is needed anymore to allow for boot with degraded RAID as of now (18.04).
  • user2763405
    user2763405 over 7 years
    You just solved my 1 weeks searching ... Thanks man.
  • Kevin Lyda
    Kevin Lyda over 6 years
    That bug is a depressing read.
  • Kevin Lyda
    Kevin Lyda over 6 years
    You put this script in /usr/share/initramfs-tools/scripts/local-top/mdadm and then install with update-initramfs -k all -u. However it will generate a warning. to disable the warning put case ${1:-} in prereqs) echo "multipath"; exit 0;; esac prior to the . /scripts/functions line.
  • Andrey  Kopeyko
    Andrey Kopeyko over 6 years
    Yes, it generates a warning - but this warning is harmless. I think hacking functions isn't a good idea because of possible side effects. So I simply ignore this warning.