#1109801 Mdadm fails to give error message if the wrong parameters given to add command

Package:
mdadm
Source:
mdadm
Description:
Tool to administer Linux MD arrays (software RAID)
Submitter:
Patrick Dunford
Date:
2025-07-24 08:19:02 UTC
Severity:
normal
#1109801#5
Date:
2025-07-24 01:59:51 UTC
From:
To:
When an array is created or modified, new disks are added. The add command takes a parameter, which must be a partition of an existing disk
e.g. /dev/sda1

If the user only specifies a device e.g. /dev/sda, mdadm will claim the disk has been added and show all normal indications and messages for the device. For example it shows that the array is building and syncing with the progress updates. However, the array will not start at boot time and no error messages are given to indicate why the array failed to start.

#1109801#10
Date:
2025-07-24 05:44:06 UTC
From:
To:
Hi Patrick,

thank you for your report.

To be sure that I understand you correctly, can you clarify for me which
case you're after:

a) the correct device to be added is /dev/sda (without a /dev/sda1 being
present) and that doesn't work like you described.

or

b) the correct device to be added is /dev/sda1 (which is being present)
but when you add /dev/sda instead, it doesn't work like you described.

Regards,
Daniel

#1109801#15
Date:
2025-07-24 08:16:59 UTC
From:
To:
JFTR


Hello
In order to create a working array the following steps of preparation
are required for each disk in the array (this has been found to be the
only method which works):

1. Create a GPT partition table on the disk e.g. /dev/sda
2. Create a filesystem partition (e.g. ext4) on the disk e.g. /dev/sda1
3. Add the partition to the MD array

This therefore is described in your case (b)

#1109801#20
Date:
2025-07-24 08:17:50 UTC
From:
To:
Hi Patrick,

please keep the bug in CC, so your messages get added to the bug in the
tracking system. I've forwarded your previous message accordingly.

I'm afraid this is not what you initially wrote, so I guess that was
just a typo (you wrote you'd be adding /dev/sda, not /dev/sda1 to the
array).

now, given the above, there are two things to note:

a) when you add a device to an array, there is no need to format it as
    all data will be overwritten by mdadm during the resync anyway.
    (it might even cause problems if you do so)

b) all partitions need to be of type "raid", usually presented as
    "Linux RAID" (e.g. in cfdisk).

both a) and b) are the standard way of doing things, which is inline
with all documentation I've ever seen about mdadm/RAID on Linux. Doing
so, also never resultet in any problems for where things wouldn't work
as expected.

can you retry with both taking a) and b) into account?

Regards,
Daniel