Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

md/raid cannot start dirty degraded array: why mdadm will not start it and what a forced start changes

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

When a Linux server logs md/raid:md0: cannot start dirty degraded array., the kernel has refused to start a RAID 4, 5 or 6 array because it was not shut down cleanly and also lacks a member. The kernel documentation says md "will normally refuse to start such an array" and that starting it is left to the administrator. Image the member disks first, bring back the missing disk if you can, and if a forced start is unavoidable, know that it rewrites metadata on the member disks, start the array with --readonly, and copy the data out before allowing writes.

What the error means

The kernel documentation explains the refusal: "If a raid5 or raid6 array is both dirty and degraded, it could have undetectable data corruption." Dirty means the parity cannot be trusted. Degraded means some data blocks are missing and cannot reliably be reconstructed. The same page says the refusal "requires the sysadmin to take action to explicitly start the array despite possible corruption", normally with mdadm --assemble --force.

The message is in the md driver. In drivers/md/raid5.c at tag v6.12, the code reads as follows. It tests whether the array's degraded count is greater than a counter named dirty_parity_disks while the resync checkpoint is not at the end. If so it prints one of three lines: starting dirty degraded array with PPL., starting dirty degraded array - data corruption possible. when the driver flag ok_start_degraded is set, or otherwise cannot start dirty degraded array. and the start is abandoned. In drivers/md/md.c that flag takes its value from the module parameter start_dirty_degraded.

mdadm 4.2 adds its own wording in Assemble.c. For a RAID 4, 5 or 6 array that is not clean and has too few devices, it prints Consider --force to start dirty degraded array. With --force, if fewer devices were given than were present before and --run was not given, it prints Consider --run to start array as degraded. With --force on a RAID 4, 5 or 6 array that has fewer disks than it should, the code sets the resync start to the end and prints that the array state was forced to clean and "It may cause data corruption." --force also writes to the members: the code raises the event count in the superblock of a member that is behind, and can mark the array clean in a member's superblock, printing Marking array %s as 'clean'. A comment in that branch says forcing matters for RAID 4, 5 and 6 and that other levels "are started anyway".

This is a different problem from the monitor event in mdadm DegradedArray event on /dev/md0: find the failed member and replace it, where the array is already running. For assembly on new hardware in general, see Linux software RAID after a server fails: assembling mdadm arrays on replacement hardware.

Likely causes

Cause What you see How to confirm
Power loss or crash while a member was already missing or failed The message at boot or at assembly; the array is not running The members' metadata shows one fewer device than the array should have
A member dropped out during the crash Same message; the missing disk is present in the system mdadm --examine of that disk reads metadata that differs from the others
A member is not detected (cable, controller, backplane) Same message; the disk is absent from the system The disk does not appear at all, and the remaining members agree with each other
The root file system is on the array The message appears during early boot, before the root file system is available The array is the root device

Prove the cause before changing anything

These steps only read. Use your own partition names in place of /dev/sda1, /dev/sdb1 and /dev/sdc1.

1. Read the kernel log for the message (for example with dmesg, our advice). The line md/raid:md0: cannot start dirty degraded array. confirms the check described above. The array number may differ.

2. Read what the kernel has assembled. The manual says /proc/mdstat lists all active md devices; an array that was refused is not active:

cat /proc/mdstat

3. Read the metadata on every member you can find. The manual says --examine prints "contents of the metadata stored on the named device(s)":

mdadm --examine /dev/sda1 /dev/sdb1 /dev/sdc1

A good result shows members that agree on the array and on how many devices it should have, with one device short. A bad result shows members that disagree or that report a different number of devices. Do not force anything until you know which member is missing and why. The manual says --force overrides members whose "metadata on some devices appears to be out-of-date".

Fix

Protect the data first

Protect the members before any forced start. Image every disk, or copy it, so that a mistake can be repeated from the copy: see A failing disk in a Linux server: image it before you repair it. If any member has read errors, see smartctl "SMART overall-health self-assessment test result: FAILED!": what the verdict means and what to do first.

Bring back the missing member if you can

The kernel check applies only when the array is degraded. If the missing disk can be reconnected and its metadata is current, the array is no longer degraded and a normal assembly should not meet this check. This is our reading of the driver code, not a statement in the documentation.

Force a start with the members you have

mdadm's manual says --force assembles the array "even if the metadata on some devices appears to be out-of-date", and: "An array which requires --force to be started may contain data corruption. Use it carefully." --run is the option that starts an array with fewer drives than before, and --readonly means "Start the array read only rather than read-write as normal. No writes will be allowed to the array, and no resync, recovery, or reshape will be started." --readonly controls only how the array is started; it does not stop mdadm writing to the member disks first.

First save the current state:

mdadm --examine /dev/sda1 /dev/sdb1 /dev/sdc1 > md0-examine-before.txt
cat /proc/mdstat > mdstat-before.txt

Disruptive step: the next command writes metadata to the member disks and starts a dirty, degraded array. By our reading of Assemble.c at tag mdadm-4.2, --force raises the event count in the superblock of a member that is behind and can mark the array clean in a member's superblock, before the array starts and even with --readonly. For a RAID 4, 5 or 6 array it also sets the array state to clean, so the parity is not resynced, and its own message says this "may cause data corruption". The mdadm manual gives no way to undo the metadata that mdadm rewrites: the saved --examine file and your member images are the only record of the earlier values.

Start the array with --readonly, listing only the members that are present and that you have confirmed with --examine:

mdadm --assemble --force --run --readonly /dev/md0 /dev/sda1 /dev/sdb1 /dev/sdc1

To back out: this stops the array and does not restore the earlier recorded state. If a file system on the array is mounted, unmount it first, because stopping an array that is in use fails; this is our advice, as the manual gives only the description of --stop. The manual says --stop will "deactivate array, releasing all resources". Then save the metadata again and compare it with the earlier file:

mdadm --stop /dev/md0
mdadm --examine /dev/sda1 /dev/sdb1 /dev/sdc1 > md0-examine-after.txt
diff md0-examine-before.txt md0-examine-after.txt

The diff comparison is our addition. The differences it shows are the metadata that the forced start changed; it does not put the old values back.

Check the data without writing to the array

With the array started read-only, the data can be read and copied to other storage before anything is written to the array. This is our advice; it is not a step in mdadm's manual, which gives no mounting guidance. Mounting the file system read-only (mount -o ro) is the usual way; a journalled file system may refuse that mount or need recovery first, and recovery writes. A parity array that was dirty may hold stripes that were half-written at the moment of the crash, and nothing in md can tell you which.

Allow writes only after the copy

First save the current state:

mdadm --detail /dev/md0 > md0-detail-before-rw.txt

Risk: the next command lets the array accept writes again. The manual says --readwrite "will change a readonly array back to being read/write", after which writes and recovery can begin, and writes cannot be taken back.

Return the array to read-write:

mdadm --readwrite /dev/md0

To back out: unmount any file system on the array first. The manual says --readonly marks an active array read-only "providing that it is not currently being used", so the command is refused while the array is in use. It stops further writes but does not undo writes already made:

mdadm --readonly /dev/md0
mdadm --detail /dev/md0

The root file system is on the array

The kernel documentation says the --force route "is not really available if the array has the root filesystem on it", so md supports the module parameter start_dirty_degraded, and md-mod.start_dirty_degraded=1 is the boot setting to start a dirty degraded RAID 5 or 6 root array. The kernel documentation says it "bypassed the checks"; by our reading of md.c the value applies to every array at every boot, not only the root array. It is not given as a step here; it belongs in a recovery plan made with the members already imaged.

Example (illustrative): db01 has /dev/md0, a RAID 5 of four 2 TB partitions sda1, sdb1, sdc1 and sdd1, so it holds (4 - 1) x 2 TB = 6 TB. A power cut hits while sdd1 is already failed. At boot the log shows md/raid:md0: cannot start dirty degraded array. and /proc/mdstat does not list md0. mdadm --examine on the three present members agrees, and sdd1 cannot be found. The engineer images the three members, saves the examine output, starts the array with --assemble --force --run --readonly and the three partitions, knowing mdadm may rewrite their metadata, copies the 6 TB out, and only then considers writes.

Confirm the fix

  1. cat /proc/mdstat lists md0 as active.
  2. mdadm --detail /dev/md0 shows the array started in the state you expect, degraded with the member missing.
  3. The data copy matches what you expect at file and application level, which md cannot tell you.
  4. The array is made read-write only after the copy exists.

What to watch afterwards

  • Replace or reconnect the missing member and let the rebuild finish, following mdadm DegradedArray event on /dev/md0: find the failed member and replace it.
  • The kernel documentation describes a check action in sync_action and a mismatch_count; after the array is healthy, a check reads all blocks and counts the sectors that did not match.
  • Find why the shutdown was unclean (power, controller or cable) before trusting the array again.

Risks and limits

  • These commands have not been run or lab-tested.
  • A forced start of a dirty degraded RAID 4, 5 or 6 array can expose or cause data corruption that no md tool can detect.
  • mdadm's behaviour here is read from the source at tag mdadm-4.2 and the kernel's from tag v6.12; other versions may differ.
  • The kernel check read here is in the RAID 4, 5 and 6 driver. The mdadm comment about other levels being started anyway concerns mdadm's own forcing step, not the kernel.
  • The causes in the table are our own grouping; the kernel documentation names only the dirty and degraded state.
  • Hardware RAID controllers, containers and external metadata are not covered.

Sources

  • RAID arrays — The Linux Kernel documentation, v6.12.0, no date shown, accessed 2 December 2026
  • raid5.c at tag v6.12 — Linux kernel source code at a fixed tag, no date shown, accessed 2 December 2026
  • md.c at tag v6.12 — Linux kernel source code at a fixed tag, no date shown, accessed 2 December 2026
  • mdadm(8) — Debian Manpages, bookworm (mdadm 4.2-5), source last updated 24 February 2023, accessed 2 December 2026
  • Assemble.c at tag mdadm-4.2 — mdadm source code at a fixed tag, no date shown, accessed 2 December 2026