You are not logged in.

#1 2025-11-11 15:30:54

szebenyib
Member
From: LHBP
Registered: 2011-10-18
Posts: 75

[SOLVED] Raid 1 not rebuilding

Recently one of my raid devices have failed in a raid 1 array. It turned out that it was faulty as dmesg pointed out with I/O error - it could not be added to the raid again.

I had an identical drive, which I have put in the machine, and removed the older one. I have copied over the partition table via

sfdisk -d /dev/sdb | sfdisk /dev/sda

(It was sda, which has failed)

Then I could use the add command to add it to the array. Then I shut the system down (sudo shutdown -h now) as I wanted to move it back to its place.

Now after that it looks like this:

:~$ sudo mdadm --detail /dev/md0
/dev/md0:
           Version : 1.2
        Raid Level : raid1
     Total Devices : 2
       Persistence : Superblock is persistent

             State : inactive
   Working Devices : 2

              Name : somehost:0  (local to host somehost)
              UUID : 6db595ef:6ceddb99:be179bf7:e0798b4f
            Events : 399352

    Number   Major   Minor   RaidDevice

       -       8       21        -        /dev/sdb5
       -       8        5        -        /dev/sda5

But it is not rebuilding or anything. If I run the array, then:

:~$ sudo mdadm --manage /dev/md0 --run
mdadm: failed to start array /dev/md/0: Invalid argument
:~$ sudo mdadm --detail /dev/md0
/dev/md0:
           Version : 1.2
     Creation Time : Wed Feb 27 14:31:31 2013
        Raid Level : raid1
     Used Dev Size : 972723008 (927.66 GiB 996.07 GB)
      Raid Devices : 2
     Total Devices : 1
       Persistence : Superblock is persistent

       Update Time : Tue Nov 11 15:11:55 2025
             State : active, FAILED, Not Started
    Active Devices : 0
   Working Devices : 1
    Failed Devices : 0
     Spare Devices : 1

Consistency Policy : unknown

    Number   Major   Minor   RaidDevice State
       -       0        0        0      removed
       -       0        0        1      removed

       -       8        5        0      spare rebuilding   /dev/sda5

Why is it not rebuilding? Also where has sdb vanished? Before issuing this command there is an md0 entry below sdb5 in lsblk, now it is gone. dmesg does not show I/O error and nmon does not show hdd activity.

Last edited by szebenyib (2025-11-12 08:37:17)

Offline

#2 2025-11-11 15:46:25

frostschutz
Member
Registered: 2013-11-15
Posts: 1,640

Re: [SOLVED] Raid 1 not rebuilding

mdadm --examine for all devices?

logs of previous assembly / failure events if you have them?

seems like the remaining drive did not have an active role / considers itself failed or spare - at this point you might have to re-create with the correct offsets, settings and hope for the best. (see https://unix.stackexchange.com/a/131927/30851 on recovery using mdadm create)

or just try to read-only mount it at an offset, ignoring the raid altogether (since it's raid1), just to see if it still has your data

Last edited by frostschutz (2025-11-11 15:50:24)

Offline

#3 2025-11-11 16:00:18

cryptearth
Member
Registered: 2024-02-03
Posts: 2,092

Re: [SOLVED] Raid 1 not rebuilding

szebenyib wrote:

I have copied over the partition table via

sfdisk -d /dev/sdb | sfdisk /dev/sda

WHY? where do you got this from? what did you thought this would do?
have a look here: https://wiki.archlinux.org/title/RAID#R … m_an_array
have you executed either

# mdadm --fail /dev/md0 /dev/failing_array_member
# mdadm --remove /dev/md0 /dev/failing_array_member
# mdadm /dev/md0 --add /dev/sdc1

or

# mdadm /dev/md0 --add /dev/sdc1
# mdadm /dev/md0 --replace /dev/sdb1 --with /dev/sdc1
# mdadm --remove /dev/md0 /dev/failing_array_member

?

Offline

#4 2025-11-12 08:32:18

szebenyib
Member
From: LHBP
Registered: 2011-10-18
Posts: 75

Re: [SOLVED] Raid 1 not rebuilding

frostschutz wrote:

mdadm --examine for all devices?

logs of previous assembly / failure events if you have them?

The first one did not show anything. I could not find any kind of logs for mdadm.

Offline

#5 2025-11-12 08:36:53

szebenyib
Member
From: LHBP
Registered: 2011-10-18
Posts: 75

Re: [SOLVED] Raid 1 not rebuilding

cryptearth wrote:
szebenyib wrote:

I have copied over the partition table via

sfdisk -d /dev/sdb | sfdisk /dev/sda

WHY? where do you got this from? what did you thought this would do?
have a look here: https://wiki.archlinux.org/title/RAID#R … m_an_array
have you executed either

# mdadm --fail /dev/md0 /dev/failing_array_member
# mdadm --remove /dev/md0 /dev/failing_array_member
# mdadm /dev/md0 --add /dev/sdc1

or

# mdadm /dev/md0 --add /dev/sdc1
# mdadm /dev/md0 --replace /dev/sdb1 --with /dev/sdc1
# mdadm --remove /dev/md0 /dev/failing_array_member

?

Because I wanted the new disk to have the same layout as the one in the array. So it was not to clean the disk or anything.

I have tried the below commands numerous times but it did not help.

The issue may have been that the cable may have been moved when the hardware was moved back to its place after shutdown. Maybe not. The point is that I have started the system with just the old but working member. Then started the array. Then hot plugged in the new disk, then re-added it, and it started rebuliding the spare. Having rebuilt it the array is now in a clean state and after a reboot the spare took its place, showing:

       Update Time : Wed Nov 12 08:45:12 2025
             State : clean
    Active Devices : 2
   Working Devices : 2
    Failed Devices : 0
     Spare Devices : 0

Consistency Policy : resync

              Name : 
              UUID : 6db595ef:6ceddb99:be179bf7:e0798b4f
            Events : 399563

    Number   Major   Minor   RaidDevice State
       3       8        5        0      active sync   /dev/sda5
       2       8       21        1      active sync   /dev/sdb5

Offline

Board footer

Powered by FluxBB