MD raid5 array appears to have stopped working suddenly. Symptoms are somewhat similar to this issue in that I'm getting errors talking about not enough devices to start the array, however in my case the event counts on all three drives are equal. It's a raid 5 array that should have 2 active drives and one parity, however mdadm --examine on each drive shows two of them having their role listed as spare and only one as an active drive.
I've tried mdadm --stop /dev/md1 followed by mdadm --assemble /dev/md1 (including attempts with the --force and --run flags).
SMART data doesn't indicate any issues with the drives (and current pending and reallocated sector counts are all zero), I've tried the raid.wiki.kernel.org guide linked below by frostschutz through the steps involving setting up mapped overlay devices.
I would have then assumed running the following command would create a raid array that I could then attempt to mount read-only and see if that resulted in a readable filesystem or just a garbled mess (i.e. to determine if my guess of sdf1 being the parity drive was correct or if I should try again with sde1) - but instead it gives the error show below (have also tried with the associated loop devices as per losetup --list, with the same result).
mdadm --create /dev/md2 --assume-clean --level=5 --chunk=64K --metadata=1.2 --data-offset=261888s --raid-devices=3 missing /dev/mapper/sdh1 /dev/mapper/sdf1
mdadm: super1.x cannot open /dev/mapper/sdh1: Device or resource busy
mdadm: /dev/mapper/sdh1 is not suitable for this array.
mdadm: super1.x cannot open /dev/mapper/sdf1: Device or resource busy
mdadm: /dev/mapper/sdf1 is not suitable for this array.
mdadm: create aborted
Also, while mdadm --detail /dev/md1 previously gave the output (further) below, it now gives:
/dev/md1:
Version : 1.2
Raid Level : raid0
Total Devices : 3
Persistence : Superblock is persistent
State : inactive
Working Devices : 3
Name : bob:1 (local to host bob)
UUID : 07ff9ba9:e8100e68:94c12c1a:3d7ad811
Events : 373364
Number Major Minor RaidDevice
- 253 11 - /dev/dm-11
- 253 10 - /dev/dm-10
- 253 9 - /dev/dm-9
Also, I've noticed dmsetup status gives the same information for all three overlays, and has a number that looks suspiciously like it may refer to the size of original raid array (16TB) rather than an individual drive (8TB) - not sure if this is as it should be?
sde1: 0 15627528888 snapshot 16/16777216000 16
sdh1: 0 15627528888 snapshot 16/16777216000 16
sdf1: 0 15627528888 snapshot 16/16777216000 16
Not sure how to progress from this point as far as attempting to create the device, mount and inspect the filesystem to confirm whether I guessed the correct parity device or not, using the overlay to prevent anything being written to the actual drives.
UPDATE: As per frostschutz's suggestion below, the array was somehow in some kind of state where --stop needed to be issued prior to being able to do anything with the underlying drives. I'd discounted that possibility previously as cat /proc/mdstat was showing the array as inactive, which I'd assumed meant it could not possibly be what was tying the drives up, but that was not in fact the case (I'd also previously ran --stop, but it would seem something was done afterwards triggering it's return to a non-stopped state). After getting the drive order correct (not on the first try, glad I was using overlays) the array passed a fsck check with no errors reported and is now up and running as if nothing ever happened.
The result of running other diagnostic commands:
cat /proc/mdstat:
Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10]
md1 : inactive sdh1[1](S) sde1[3](S) sdf1[0](S)
23440900500 blocks super 1.2
mdadm --detail /dev/md1:
/dev/md1:
Version : 1.2
Raid Level : raid0
Total Devices : 3
Persistence : Superblock is persistent
State : inactive
Working Devices : 3
Name : bob:1 (local to host bob)
UUID : 07ff9ba9:e8100e68:94c12c1a:3d7ad811
Events : 373364
Number Major Minor RaidDevice
- 8 113 - /dev/sdh1
- 8 81 - /dev/sdf1
- 8 65 - /dev/sde1
lines appearing in dmesg when trying to mdadm --assemble /dev/md1:
md/raid:md1: device sdh1 operational as raid disk 1
md/raid:md1: not enough operational devices (2/3 failed)
md/raid:md1: failed to run raid set.
md: pers->run() failed ..
and the mdadm --examines
/dev/sde1:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x1
Array UUID : 07ff9ba9:e8100e68:94c12c1a:3d7ad811
Name : bob:1 (local to host bob)
Creation Time : Mon Mar 4 22:10:29 2019
Raid Level : raid5
Raid Devices : 3
Avail Dev Size : 15627267000 (7451.66 GiB 8001.16 GB)
Array Size : 15627266688 (14903.32 GiB 16002.32 GB)
Used Dev Size : 15627266688 (7451.66 GiB 8001.16 GB)
Data Offset : 261888 sectors
Super Offset : 8 sectors
Unused Space : before=261808 sectors, after=312 sectors
State : clean
Device UUID : e856f539:6a1b5822:b3b8bfb7:4d0f4741
Internal Bitmap : 8 sectors from superblock
Update Time : Sun May 30 00:22:45 2021
Bad Block Log : 512 entries available at offset 40 sectors
Checksum : 9b5703bc - correct
Events : 373364
Layout : left-symmetric
Chunk Size : 64K
Device Role : spare
Array State : .AA ('A' == active, '.' == missing, 'R' == replacing)
/dev/sdf1:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x1
Array UUID : 07ff9ba9:e8100e68:94c12c1a:3d7ad811
Name : bob:1 (local to host bob)
Creation Time : Mon Mar 4 22:10:29 2019
Raid Level : raid5
Raid Devices : 3
Avail Dev Size : 15627267000 (7451.66 GiB 8001.16 GB)
Array Size : 15627266688 (14903.32 GiB 16002.32 GB)
Used Dev Size : 15627266688 (7451.66 GiB 8001.16 GB)
Data Offset : 261888 sectors
Super Offset : 8 sectors
Unused Space : before=261800 sectors, after=312 sectors
State : clean
Device UUID : 7919e56f:2e08430e:95a4c4a6:1e64606a
Internal Bitmap : 8 sectors from superblock
Update Time : Sun May 30 00:22:45 2021
Bad Block Log : 512 entries available at offset 72 sectors
Checksum : d54ff3e1 - correct
Events : 373364
Layout : left-symmetric
Chunk Size : 64K
Device Role : spare
Array State : .AA ('A' == active, '.' == missing, 'R' == replacing)
/dev/sdh1:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x1
Array UUID : 07ff9ba9:e8100e68:94c12c1a:3d7ad811
Name : bob:1 (local to host bob)
Creation Time : Mon Mar 4 22:10:29 2019
Raid Level : raid5
Raid Devices : 3
Avail Dev Size : 15627267000 (7451.66 GiB 8001.16 GB)
Array Size : 15627266688 (14903.32 GiB 16002.32 GB)
Used Dev Size : 15627266688 (7451.66 GiB 8001.16 GB)
Data Offset : 261888 sectors
Super Offset : 8 sectors
Unused Space : before=261800 sectors, after=312 sectors
State : clean
Device UUID : 0c9a8237:7e79a439:d4e35b31:659f3c86
Internal Bitmap : 8 sectors from superblock
Update Time : Sun May 30 00:22:45 2021
Bad Block Log : 512 entries available at offset 72 sectors
Checksum : 6ec2604b - correct
Events : 373364
Layout : left-symmetric
Chunk Size : 64K
Device Role : Active device 1
Array State : .AA ('A' == active, '.' == missing, 'R' == replacing)