9

I set up a Debian wheezy (7.6), installed openmediavault, and created a software RAID 5 with that. It is listed at /dev/md127. Now I want to move that to a virtual XEN VM. To do so, I have to stop Debian to automatically assemble the RAID at startup, so I can put it through to the VM via xm block-attach, and I don't get that to work. No matter what I try, there is still md127 listed under /dev/, and after every boot I can manually end it via mdadm --stop /dev/md127. But even after that, it is still listed under /dev/.

What I already tried:

  • /etc/mdadm/mdadm.conf: commented out array line:

    #ARRAY /dev/md0 metadata=1.2 name=masterbox:MainRaid UUID=3f620e6d:4e655d66:b931eb71:baf7cf3a  
    ARRAY /dev/md0 name=Null
    
  • moved /libs/udev/rules.d/64-md-raid.rules to /root/

  • update-initramfs u
  • commented out the line in /etc/fstab
  • disassembled RAID manually via mdadm --stop /dev/md127
  • set kernel parameter raid=noautodetect in /etc/default/grub:

    GRUB_CMDLINE_LINUX_DEFAULT="quiet raid=noautodetect"  
    
  • rebooted

  • disabled mdadm services at boot

Here's also the log from dmesg:

[    3.448121] md: md127 stopped.
[    3.452518] md: bind<sda>
[    3.452747] md: bind<sdc>
[    3.452933] md: bind<sdb>

[    3.954794] md: raid6 personality registered for level 6
[    3.954797] md: raid5 personality registered for level 5
[    3.954799] md: raid4 personality registered for level 4
[    3.955417] bio: create slab <bio-1> at 1
[    3.955436] md/raid:md127: device sdb operational as raid disk 0
[    3.955439] md/raid:md127: device sdc operational as raid disk 2
[    3.955442] md/raid:md127: device sda operational as raid disk 1
[    3.955740] md/raid:md127: allocated 3228kB
[    3.955988] md/raid:md127: raid level 5 active with 3 out of 3 devices, algorithm 2
[    3.955991] RAID conf printout:
[    3.955993]  --- level:5 rd:3 wd:3
[    3.955996]  disk 0, o:1, dev:sdb
[    3.955999]  disk 1, o:1, dev:sda
[    3.956000]  disk 2, o:1, dev:sdc
[    3.956044] md127: detected capacity change from 0 to 6000916561920

... How can I bring Debian to not touch the RAID drives at all, so I can pass them to my VM?

4
  • Uninstall mdadm from dom0? Unfortunately that assumes dom0 doesn't need any other RAID devices though.
    – Celada
    Commented Nov 9, 2014 at 22:01
  • @Celada: Yeah, I did this now and it solves my problem. Though it is of course not the best solution :p
    – Droids
    Commented Nov 12, 2014 at 9:04
  • Why don't you just pass the already assembled raid array to the domU instead of the individual disks?
    – psusi
    Commented Oct 4, 2015 at 19:29
  • Well, I wanted to let the NAS-Software in the VM to manage everything - from assembling drives to a raid, to assigning and sharing filesystems. The root-OS was supposed to really only host the VMs, and nothing more. Of course that would have been at least a simple solution. Sadly I cannot try it anymore, as I have re-installed my entire homeserver to a no-virtualization-solution.
    – Droids
    Commented Oct 6, 2015 at 10:20

7 Answers 7

8

This is an old question, but since I searched quite long for a solution, I want to share my result:

# /etc/mdadm/mdadm.conf
ARRAY <ignore> UUID=3f620e6d:4e655d66:b931eb71:baf7cf3a

From man mdadm.conf:

ARRAY

    The ARRAY lines identify actual arrays.  The second word on the line may be the name of the device where the array is normally assembled, such as /dev/md1 or /dev/md/backup.  If the name does not start with a slash ('/'), it is treated as being in /dev/md/.  Alternately the word <ignore> (complete with angle brackets) can be given in which case any array which matches the rest of the line will never be automatically assembled.  If no device name is given, mdadm will use various heuristics to determine an appropriate name.

3
  • Thx! I am using my installation without virtualization since then, but maybe I find the time to try the XEN approach again with your tip. Will update this post then.
    – Droids
    Commented Nov 9, 2017 at 11:04
  • Also I read somewhere here that AUTO -all in mdadm.conf stops auto-assembling, but the whole file will be ignored, if it does not include an ARRAY line. So in order to ignore all arrays add ARRAY <ignore> UUID=00000000:00000000:00000000:00000000 and AUTO -all to mdadm.conf (not tested).
    – Toxiro
    Commented Nov 9, 2017 at 15:26
  • @Toxiro It does work, see Slawomir's answer, and I've double-checked it on Debian 9.6.
    – nh2
    Commented Apr 17, 2020 at 21:37
4

You said you disabled the mdadm service, but that service runs the monitoring deamon; there's a separate mdadm-raid service that starts all md arrays in userland based on the configuration file. And, you can also run dpkg-reconfigure mdadm to disable auto-starting arrays.

3

On Ubuntu 18.04, this worked (append it to /etc/mdadm/mdadm.conf):

AUTO -all
ARRAY <ignore> UUID=00000000:00000000:00000000:00000000

Nothing was auto-assembled after that point.

1
  • This also works on Debian 9.6.
    – nh2
    Commented Apr 17, 2020 at 21:37
1

I found removing udev rules for mdadm raid-assembly was the only thing that worked:

/lib/udev/rules.d/64-md-raid-assembly.rules

Maybe move it to home directory.

0

I realized if you delete /etc/mdadm/mdadm.conf (or /etc/mdadm.conf) and if you have the mount entry in etc/fstab new mdadm.conf gets created automatically.

I put # and commented out fstab and mdadm.conf entry without deleting .conf file.

It stopped auto assembling array and automounting.

1
  • Since th OP said that they "commented out the line in /etc/fstab" I guess the main difference here is that you also commented out the entry from mdadm.conf.
    – Jeff Schaller
    Commented Aug 9, 2020 at 15:09
0

I resolved that situation on TrueNAS SCALE and OpenMediaVault, which both build on Debian by removing every file md* inside

ls -R /usr/share/initramfs-tools/*|grep ^md

and update the init

update-initramfs -u

and now no more time waiting for mdadm which randomly mount raid's

ps: I also took the time to remove every file which was pointed at btrfs, dm, lvm, ntfs, xfs without any issue

my Debian boot superfast now :)

1
  • That works fine, but you do not need to delete the files (just in case you want to restore the functionality later), you can simple remove the executable bit: chmod -x /usr/share/initramfs-tools/{hooks,scripts/local-block,scripts/local-bottom}/mdadm
    – inta
    Commented Mar 4 at 13:51
0

Previously it was mentioned that removing /lib/udev/rules.d/64-md-raid-assembly.rules could help. I looked up the contents of file and seems it will be enough to add two kernel cmdline parameters: noiswmd and nodmraid.

# "noiswmd" on kernel command line stops mdadm from handling
#  "isw" (aka IMSM - Intel RAID).
# "nodmraid" on kernel command line stops mdadm from handling
#  "isw" or "ddf".
IMPORT{cmdline}="noiswmd"
IMPORT{cmdline}="nodmraid"

ENV{nodmraid}=="?*", GOTO="md_inc_end"
ENV{ID_FS_TYPE}=="ddf_raid_member", GOTO="md_inc"
ENV{noiswmd}=="?*", GOTO="md_inc_end"
ENV{ID_FS_TYPE}=="isw_raid_member", GOTO="md_inc"
GOTO="md_inc_end"
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .