Simple mdadm RAID 1 not activating spare
Posted
by
Nick Liu
on Super User
See other posts from Super User
or by Nick Liu
Published on 2012-05-28T17:37:00Z
Indexed on
2012/06/01
16:44 UTC
Read the original article
Hit count: 307
I had created two 2TB HDD partitions (/dev/sdb1
and /dev/sdc1
) in a RAID 1 array called /dev/md0
using mdadm
on Ubuntu 12.04 LTS Precise Pangolin.
The command sudo mdadm --detail /dev/md0
used to indicate both drives as active sync.
Then, for testing, I failed /dev/sdb1
, removed it, then added it again with the command sudo mdadm /dev/md0 --add /dev/sdb1
watch cat /proc/mdstat
showed a progress bar of the array rebuilding, but I wouldn't spend hours watching it, so I assumed that the software knew what it was doing.
After the progress bar was no longer showing, cat /proc/mdstat
displays:
md0 : active raid1 sdb1[2](S) sdc1[1]
1953511288 blocks super 1.2 [2/1] [U_]
And sudo mdadm --detail /dev/md0
shows:
/dev/md0:
Version : 1.2
Creation Time : Sun May 27 11:26:05 2012
Raid Level : raid1
Array Size : 1953511288 (1863.01 GiB 2000.40 GB)
Used Dev Size : 1953511288 (1863.01 GiB 2000.40 GB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent
Update Time : Mon May 28 11:16:49 2012
State : clean, degraded
Active Devices : 1
Working Devices : 2
Failed Devices : 0
Spare Devices : 1
Name : Deltique:0 (local to host Deltique)
UUID : 49733c26:dd5f67b5:13741fb7:c568bd04
Events : 32365
Number Major Minor RaidDevice State
1 8 33 0 active sync /dev/sdc1
1 0 0 1 removed
2 8 17 - spare /dev/sdb1
I've been told that mdadm automatically replaces removed drives with spares, but /dev/sdb1
isn't being moved into the expected position, RaidDevice 1
.
UPDATE (30 May 2012): A badblocks
destructive read-write test of the entire /dev/sdb
yielded no errors as expected; both HDDs are new.
As of the latest edit, I assembled the array with this command:
sudo mdadm --assemble --force --no-degraded /dev/md0 /dev/sdb1 /dev/sdc1
The output was:
mdadm: /dev/md0 has been started with 1 drive (out of 2) and 1 rebuilding.
Rebuilding looks like it's progressing normally:
md0 : active raid1 sdc1[1] sdb1[2]
1953511288 blocks super 1.2 [2/1] [U_]
[>....................] recovery = 0.6% (13261504/1953511288) finish=2299.7min speed=14060K/sec
unused devices: <none>
I'm now waiting on this rebuild, but I'm expecting /dev/sdb1
to become a spare just like the five or six times that I've tried rebuilding before.
UPDATE (31 May 2012): Yeah, it's still a spare. Ugh!
UPDATE (01 June 2012): I'm trying Adrian Kelly's suggested command:
sudo mdadm --assemble --update=resync /dev/md0 /dev/sdb1 /dev/sdc1
Waiting on the rebuild now...
My questions are:
- Why isn't the spare drive becoming active sync?
- How can I make the spare drive become active?
© Super User or respective owner