Score:0

How to force degraded mdadm raid1 array to start and mount on boot?

kp flag

How do I force raid1 array(neither root, nor boot) without all components present from failing to start on system boot?

I am using Ubuntu 21.10. File system used is ext4.

Expected behavior

  • Install a system with RAID1 and two hard-drives and boot the system with array in-sync
  • Shutdown
  • Disconnect one of the drives and thus boot, unexpectedly, degraded
  • The boot should complete.
  • Shutdown, and boot again, expecting degraded state.
  • The boot should complete.
  • Shutdown, reconnect disconnected drive, and boot again.
  • The boot should complete, add the device to the array, the array should be resyncing, and results with system with array in-sync, just like at the beginning of the testcase.

Tried the following with no results:

  1. set "BOOT_DEGRADED=true" in /etc/initramfs-tools/conf.d/mdadm (new file created) (not supported from mdadm-3.2.5-5ubuntu3 / Ubuntu 14.04 onwards)
  2. set bootdegraded=true in grub
  3. looked at #dpkg-reconfigure mdadm

Found this old article that uses an initramfs script, but it references currently non-existant config files. Is this the best/only way to achieve the desired behavior?

Including output of cat /proc/mdstat and mdadm --detail /dev/mdx before and after mdadm --run /dev/mdx

    ~$ cat /proc/mdstat
    Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 
    md126 : inactive sda3[2](S)
          124861440 blocks super 1.2
           
    md127 : inactive mmcblk0[0](S) sda2[1](S)
          243890176 blocks super 1.2
           
    unused devices: <none>
    
    ~$ sudo mdadm -D /dev/md/store
    mdadm: cannot open /dev/md/store: No such file or directory
    
    ~$ sudo mdadm -D /dev/md126
    /dev/md126:
               Version : 1.2
            Raid Level : raid1
         Total Devices : 1
           Persistence : Superblock is persistent
    
                 State : inactive
       Working Devices : 1
    
                  Name : asus-x200la:store  (local to host asus-x200la)
                  UUID : 8536f840:806e8d2f:b576dbe4:38ea1de6
                Events : 3840
    
        Number   Major   Minor   RaidDevice
    
           -       8        3        -        /dev/sda3

~$ sudo mdadm --run /dev/md126
mdadm: started array /dev/md/store

~$ cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 
md126 : active (auto-read-only) raid1 sda3[2]
      124860416 blocks super 1.2 [3/1] [__U]
      bitmap: 0/1 pages [0KB], 65536KB chunk

md127 : inactive mmcblk0[0](S) sda2[1](S)
      243890176 blocks super 1.2
       
unused devices: <none>

~$ sudo mdadm -D /dev/md126
/dev/md126:
           Version : 1.2
     Creation Time : Fri Oct 22 19:05:29 2021
        Raid Level : raid1
        Array Size : 124860416 (119.08 GiB 127.86 GB)
     Used Dev Size : 124860416 (119.08 GiB 127.86 GB)
      Raid Devices : 3
     Total Devices : 1
       Persistence : Superblock is persistent

     Intent Bitmap : Internal

       Update Time : Tue Oct 26 19:11:58 2021
             State : clean, degraded 
    Active Devices : 1
   Working Devices : 1
    Failed Devices : 0
     Spare Devices : 0

Consistency Policy : bitmap

              Name : asus-x200la:store  (local to host asus-x200la)
              UUID : 8536f840:806e8d2f:b576dbe4:38ea1de6
            Events : 3840

    Number   Major   Minor   RaidDevice State
       -       0        0        0      removed
       -       0        0        1      removed
       2       8        3        2      active sync   /dev/sda3
in flag
Can you [edit] your question to include: (0) the output of `mdadm -D /dev/md0` (1) the file system used. If the array is not in a clean state, it will not mount. There are also issues with some file systems not liking it when a device disappears from an array.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.