First of all, I'm not sure if this is an issue with mdadm itself, with systemd, udev or Debian, but I'll try here first. Feel free to tell me to raise this issue somewhere else if this is not related to this project.
I have a Debian Trixie 13 system, installed with debootstrap, with an madm RAID1 array /dev/md/esp mounted under /boot/efi. It's actually a KVM VM that I built to test this setup. If I shut down the VM, remove one of the drives and restart, the array does not get assembled/started and remains as inactive as per proc/mdstat.
As far as I have been able to determine, what is supposed to happen is that udev detects the remaining drive and then starts a systemd timer mdadm-last-resort@md127.timer through a udev rule from /lib/udev/rules.d/64-md-raid-assembly.rules:
ACTION!="remove", ENV{MD_STARTED}=="*unsafe*", ENV{MD_FOREIGN}=="no", ENV{SYSTEMD_WANTS}+="mdadm-last-resort@$env{MD_DEVICE}.timer"
This rule never seems to get fired however. I can test this by running in one terminal:
udevadm monitor --environment --udev
and then from another terminal:
sudo udevadm trigger --action=add /sys/class/block/md127
The first terminal will now show:
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
UDEV [71.177525] add /devices/virtual/block/md127 (block)
ACTION=add
DEVPATH=/devices/virtual/block/md127
SUBSYSTEM=block
SYNTH_UUID=0
DEVNAME=/dev/md127
DEVTYPE=disk
DISKSEQ=2
SEQNUM=2697
USEC_INITIALIZED=1228668
ID_IGNORE_DISKSEQ=1
SYSTEMD_READY=0
UDISKS_MD_DEVICES=1
UDISKS_MD_METADATA=1.0
UDISKS_MD_UUID=348d222f:a97865fe:e49a1e7b:c3db1ab1
UDISKS_MD_NAME=any:esp
UDISKS_MD_DEVICE_dev_vda1_ROLE=spare
UDISKS_MD_DEVICE_dev_vda1_DEV=/dev/vda1
MAJOR=9
MINOR=127
TAGS=:systemd:
CURRENT_TAGS=:systemd:
I can just not figure out why this udev rule does not get fired and the systemd timer does not get created. I can start the systemd timer manually (sudo systemctl start mdadm-last-resort@md127.timer) and this does cause the array to get started (although I have to mount it manually then).
Array was created with:
yes | mdadm --create --verbose --level 1 --metadata 1.0 \
--homehost any --raid-devices 2 /dev/md/esp \
/dev/vda1 /dev/vdb1
mdadm --assemble --scan
mdadm --detail --scan >> /etc/mdadm/mdadm.conf
Note that I followed the instructions from the ZFSBootMenu project for this. Also, this really seems to create /dev/md127, with /dev/md/esp as a symlink to that.
mdadmin.conf:
# mdadm.conf
#
# !NB! Run update-initramfs -u after updating this file.
# !NB! This will ensure that initramfs has an uptodate copy.
#
# Please refer to mdadm.conf(5) for information about this file.
#
# by default (built-in), scan all partitions (/proc/partitions) and all
# containers for MD superblocks. alternatively, specify devices to scan, using
# wildcards if desired.
#DEVICE partitions containers
# automatically tag new arrays as belonging to the local system
HOMEHOST <system>
# instruct the monitoring daemon where to send mail alerts
MAILADDR root
AUTO +all
# definitions of existing MD arrays
ARRAY /dev/md127 metadata=1.0 UUID=348d222f:a97865fe:e49a1e7b:c3db1ab1
# This configuration was auto-generated on Fri, 17 Apr 2026 09:01:14 +0000 by mkconf
/etc/fstab:
UUID=F2A1-708E /boot/efi vfat defaults,x-systemd.device-timeout=40s,nofail 0 0
Versions:
mdadm - v4.4 - 2024-11-07 - Debian 4.4-11
Linux hoster 6.12.74+deb13+1-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.74-2 (2026-03-08) x86_64 GNU/Linux
First of all, I'm not sure if this is an issue with
mdadmitself, withsystemd,udevor Debian, but I'll try here first. Feel free to tell me to raise this issue somewhere else if this is not related to this project.I have a Debian Trixie 13 system, installed with
debootstrap, with anmadmRAID1 array/dev/md/espmounted under/boot/efi. It's actually a KVM VM that I built to test this setup. If I shut down the VM, remove one of the drives and restart, the array does not get assembled/started and remains as inactive as perproc/mdstat.As far as I have been able to determine, what is supposed to happen is that
udevdetects the remaining drive and then starts a systemd timermdadm-last-resort@md127.timerthrough audevrule from/lib/udev/rules.d/64-md-raid-assembly.rules:This rule never seems to get fired however. I can test this by running in one terminal:
and then from another terminal:
The first terminal will now show:
I can just not figure out why this udev rule does not get fired and the systemd timer does not get created. I can start the systemd timer manually (
sudo systemctl start mdadm-last-resort@md127.timer) and this does cause the array to get started (although I have to mount it manually then).Array was created with:
Note that I followed the instructions from the ZFSBootMenu project for this. Also, this really seems to create
/dev/md127, with/dev/md/espas a symlink to that.mdadmin.conf:
/etc/fstab:
Versions: