Skip to contentSkip to conversation

trouble adding spare

DISCUSSION Max Waterman 3 participants 13 messages Jan 14, 2009 – Jan 22, 2009 MD RAID

lore
Share & tools
lore
#0 lore raw

Hi,

I have a RAID5 array using 6 disks and 2 spares. I took one spare away for a few months for another purpose (OS X) and am having trouble adding it back in as a spare.

I can add it manually :

sudo /sbin/mdadm /dev/md2 -a /dev/sdi

but it doesn't want to add itself in after rebooting (the other spare is added ok).

I'm sure this is simple for someone...

Max.

/dev/md2:

       Version : 00.90

Creation Time : Sat Aug 6 05:18:41 2005
Raid Level : raid5
Array Size : 976804480 (931.55 GiB 1000.25 GB)
Used Dev Size : 195360896 (186.31 GiB 200.05 GB)
Raid Devices : 6
Total Devices : 8
Preferred Minor : 2
Persistence : Superblock is persistent

Update Time : Wed Jan 14 11:27:11 2009
State : clean
Active Devices : 6
Working Devices : 8
Failed Devices : 0
Spare Devices : 2

Layout : left-symmetric
Chunk Size : 64K

UUID : 15bfec75:595ac793:0914f8ee:862effd8
Events : 0.9341278

Number Major Minor RaidDevice State

      0       8       80        0      active sync   /dev/sdf
      1       8       96        1      active sync   /dev/sdg
      2       8       16        2      active sync   /dev/sdb
      3       8       48        3      active sync   /dev/sdd
      4       8       32        4      active sync   /dev/sdc
      5       8       64        5      active sync   /dev/sde
      6       8      128        -      spare   /dev/sdi
      7       8      112        -      spare   /dev/sdh

..../etc/mdadm/mdadm.conf
DEVICE /dev/sd[bcdefghi]

# auto-create devices with Debian standard permissions
CREATE owner=root group=disk mode=0660 auto=yes
# automatically tag new arrays as belonging to the local system
HOMEHOST <system>
# instruct the monitoring daemon where to send mail alerts
MAILADDR [email protected]
# definitions of existing MD arrays
ARRAY /dev/md2 level=raid5 num-devices=6 UUID=15bfec75:595ac793:0914f8ee:862effd8 spares=2
#1 lore raw
Quoted 9 lines · Max Waterman

Hi,

I have a RAID5 array using 6 disks and 2 spares. I took one spare away for a few months for another purpose (OS X) and am having trouble adding it back in as a spare.

I can add it manually :

sudo /sbin/mdadm /dev/md2 -a /dev/sdi

but it doesn't want to add itself in after rebooting (the other spare is added ok).

After reboot, show dmesg/logs, what is the error? I would try:

1. mdadm --examine --scan
2. Put that info into mdadm.conf.
3. Reboot, see if its good.
4. Otherwise, remove the spare from the array, zero the mdadm superblock.
5. Re-add it to the array.
6. Worst case, zero out the drive and then re-add it and re-run step 1 and add the new information to mdadm.conf.

Quoted 54 lines

I'm sure this is simple for someone...

Max.

/dev/md2:

      Version : 00.90

Creation Time : Sat Aug 6 05:18:41 2005
Raid Level : raid5
Array Size : 976804480 (931.55 GiB 1000.25 GB)
Used Dev Size : 195360896 (186.31 GiB 200.05 GB)
Raid Devices : 6
Total Devices : 8
Preferred Minor : 2
Persistence : Superblock is persistent

Update Time : Wed Jan 14 11:27:11 2009
State : clean
Active Devices : 6
Working Devices : 8
Failed Devices : 0
Spare Devices : 2

Layout : left-symmetric
Chunk Size : 64K

         UUID : 15bfec75:595ac793:0914f8ee:862effd8
       Events : 0.9341278

Number Major Minor RaidDevice State

     0       8       80        0      active sync   /dev/sdf
     1       8       96        1      active sync   /dev/sdg
     2       8       16        2      active sync   /dev/sdb
     3       8       48        3      active sync   /dev/sdd
     4       8       32        4      active sync   /dev/sdc
     5       8       64        5      active sync   /dev/sde
     6       8      128        -      spare   /dev/sdi
     7       8      112        -      spare   /dev/sdh

..../etc/mdadm/mdadm.conf
DEVICE /dev/sd[bcdefghi]

# auto-create devices with Debian standard permissions
CREATE owner=root group=disk mode=0660 auto=yes
# automatically tag new arrays as belonging to the local system
HOMEHOST <system>
# instruct the monitoring daemon where to send mail alerts
MAILADDR [email protected]
# definitions of existing MD arrays
ARRAY /dev/md2 level=raid5 num-devices=6 UUID=15bfec75:595ac793:0914f8ee:862effd8 spares=2
#2 lore raw
Quoted 1 line · Justin Piszcz

After reboot, show dmesg/logs, what is the error?

There's no error specific to md - it seems to just ignore sdi. There are errors from 'sd' saying sdi has an unknown partition table - but I don't care about partition tables since I'm using the whole devices (ie /dev/sdi not /dev/sdi1 or whatever). /dev/sdh is the other spare.

Here's some bits from dmesg :

[    9.720380] sd 11:0:0:0: [sdi] 390721968 512-byte hardware sectors (200050 MB
)
[    9.720392] sd 11:0:0:0: [sdi] Write Protect is off
[    9.720395] sd 11:0:0:0: [sdi] Mode Sense: 00 3a 00 00
[    9.720413] sd 11:0:0:0: [sdi] Write cache: enabled, read cache: enabled, doe
sn't support DPO or FUA
[    9.720460] sd 11:0:0:0: [sdi] 390721968 512-byte hardware sectors (200050 MB
)
[    9.720471] sd 11:0:0:0: [sdi] Write Protect is off
[    9.720473] sd 11:0:0:0: [sdi] Mode Sense: 00 3a 00 00
[    9.720490] sd 11:0:0:0: [sdi] Write cache: enabled, read cache: enabled, doe
sn't support DPO or FUA
[    9.720493]  sdi: unknown partition table
[    9.725328] sd 11:0:0:0: [sdi] Attached SCSI disk
...
[   13.735948] md: md2 stopped.
[   13.755547] md: md2 stopped.
[   13.757496] md: bind<sdh>
[   13.757657] md: bind<sdg>
[   13.763358] Driver 'sr' needs updating - please use bus_type methods
[   13.767589] sr0: scsi3-mmc drive: 40x/40x cd/rw xa/form2 cdda tray
[   13.767594] Uniform CD-ROM driver Revision: 3.20
[   13.767692] sr 8:0:1:0: Attached scsi CD-ROM sr0
[   13.770178] md: md2 stopped.
[   13.770201] md: unbind<sdg>
[   13.803686] md: export_rdev(sdg)
[   13.803704] md: unbind<sdh>
[   13.806345] md: export_rdev(sdh)
[   13.809153] md: bind<sdg>
[   13.809290] md: bind<sdd>
[   13.809430] md: bind<sdh>
[   13.809577] md: bind<sdf>
[   13.812235] md: md2 stopped.
[   13.812250] md: unbind<sdf>
[   13.818201] md: export_rdev(sdf)
[   13.818217] md: unbind<sdh>
[   13.830018] md: export_rdev(sdh)
[   13.830024] md: unbind<sdd>
[   13.834004] md: export_rdev(sdd)
[   13.834011] md: unbind<sdg>
[   13.834262] md: export_rdev(sdg)
[   13.837616] md: bind<sdg>
[   13.837748] md: bind<sdb>
[   13.837870] md: bind<sdd>
[   13.837992] md: bind<sde>
[   13.838133] md: bind<sdh>
[   13.838280] md: bind<sdf>
[   13.847605] md: md2 stopped.
[   13.847620] md: unbind<sdf>
[   13.860054] md: export_rdev(sdf)
[   13.860063] md: unbind<sdh>
[   13.860091] md: export_rdev(sdh)
[   13.860096] md: unbind<sde>
[   13.860120] md: export_rdev(sde)
[   13.860126] md: unbind<sdd>
[   13.860149] md: export_rdev(sdd)
[   13.860154] md: unbind<sdb>
[   13.860176] md: export_rdev(sdb)
[   13.860182] md: unbind<sdg>
[   13.860204] md: export_rdev(sdg)
[   13.863504] md: bind<sdg>
[   13.863636] md: bind<sdb>
[   13.863759] md: bind<sdd>
[   13.863877] md: bind<sdc>
[   13.863999] md: bind<sde>
[   13.864139] md: bind<sdh>
[   13.864285] md: bind<sdf>
[   13.873381] raid5: device sdf operational as raid disk 0
[   13.873383] raid5: device sde operational as raid disk 5
[   13.873385] raid5: device sdc operational as raid disk 4
[   13.873387] raid5: device sdd operational as raid disk 3
[   13.873389] raid5: device sdb operational as raid disk 2
[   13.873391] raid5: device sdg operational as raid disk 1
[   13.873941] raid5: allocated 6312kB for md2
[   13.873944] raid5: raid level 5 set md2 active with 6 out of 6 devices, algorithm 2
[   13.873947] RAID5 conf printout:
[   13.873948]  --- rd:6 wd:6
[   13.873950]  disk 0, o:1, dev:sdf
[   13.873952]  disk 1, o:1, dev:sdg
[   13.873953]  disk 2, o:1, dev:sdb
[   13.873955]  disk 3, o:1, dev:sdd
[   13.873957]  disk 4, o:1, dev:sdc
[   13.873958]  disk 5, o:1, dev:sde

I'll give the below a try...

Thanks,

Max.

Quoted 10 lines

I would try:

1. mdadm --examine --scan
2. Put that info into mdadm.conf.
3. Reboot, see if its good.
4. Otherwise, remove the spare from the array, zero the mdadm superblock.
5. Re-add it to the array.
6. Worst case, zero out the drive and then re-add it and re-run step 1 and add the new information to mdadm.conf.

#3 lore raw
Quoted 4 lines · Max Waterman
Quoted 4 lines

I would try:

1. mdadm --examine --scan
2. Put that info into mdadm.conf.

It's already there - I think that's how I got the line in the first place.

Quoted 1 line
Quoted 1 line

4. Otherwise, remove the spare from the array, zero the mdadm superblock.

How would I do this? I tried :

$ sudo /sbin/mdadm /dev/sdi --zero-superblock --force
mdadm: /dev/sdi does not appear to be an md device

Max.

#4 lore raw
Quoted 9 lines · Max Waterman
Quoted 4 lines · Max Waterman
Quoted 4 lines

I would try:

1. mdadm --examine --scan
2. Put that info into mdadm.conf.

It's already there - I think that's how I got the line in the first place.

Quoted 1 line
Quoted 1 line

4. Otherwise, remove the spare from the array, zero the mdadm superblock.

How would I do this? I tried :

Quoted 9 lines
$ sudo /sbin/mdadm /dev/sdi --zero-superblock --force
mdadm: /dev/sdi does not appear to be an md device

Max.
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Output from when I have run this in the past:

p34:~# mdadm --zero-superblock /dev/hde1
p34:~#

If that does not work, clean the drive out manually after removing it as a spare from the array:
dd if=/dev/zero of=/dev/sdi bs=1M

Then try to re-add it.

If that still does not work you may need to modify some additional bits possibly with/in regards to the spare itself, I only have one spare in my array and I use a partition with type (fd) for the spare.

The only other thing I can think of is the events for that spare were 0.123 (example) and then after you installed OSX onto the drive, it could have deleted the superblock for mdadm from when it was created as a spare.

I have not fixed this problem in any of my use-cases, but it may(?) be necessary to re-write that superblock onto the spare so it is identified as such, however, how to do this, is a good question, it would probably be assembly or if that does not work you would need to create the array, assume clean (as you originally created it before) so the superblock is written to the spare. This all seems too complicated though, there should (and probably) is a simpler way.

Justin.

#5 lore raw
Quoted 3 lines · Justin Piszcz

Output from when I have run this in the past:

p34:~# mdadm --zero-superblock /dev/hde1
p34:~#

Ok, shuffling the args (why is it that the args are sometimes one way, and sometimes another?) made it at least run, but it made no difference to the device being added at boot-time.

Quoted 3 lines

If that does not work, clean the drive out manually after removing it as a spare from the array:
dd if=/dev/zero of=/dev/sdi bs=1M

This is taking forever. Isn't there a way to force mdadm to ignore the contents and just add it? How about a specific 'dd' that targets whatever is on the disk that is causing the problem (partition table?)?

Quoted 5 lines

Then try to re-add it.

If that still does not work you may need to modify some additional bits possibly with/in regards to the spare itself, I only have one spare in my array and I use a partition with type (fd) for the spare.

The only other thing I can think of is the events for that spare were 0.123 (example) and then after you installed OSX onto the drive,

Well, I didn't install OSX on it...just formatted it on OSX - what's that? HFS+ or something? Anyway, it makes several different partitions for some reason. Do you think that's causing the problem?

Quoted 1 line

it could have deleted the superblock for mdadm from when it was created as a spare.

I would expect it to have deleted everything on the drive.

Quoted 2 lines

I have not fixed this problem in any of my use-cases, but it may(?) be necessary to re-write that superblock onto the spare so it is identified as such, however, how to do this, is a good question, it would probably be assembly or if that does not work you would need to create the array, assume clean (as you originally created it before) so the superblock is written to the spare. This all seems too complicated though, there should (and probably) is a simpler way.

That's kind of that I was thinking...

Thanks for your continued help though :)

Max.

#6 lore raw
Quoted 4 lines · Max Waterman
Quoted 3 lines

If that does not work, clean the drive out manually after removing it as a spare from the array:
dd if=/dev/zero of=/dev/sdi bs=1M

This is taking forever

I stopped it after about half an hour, hoping that it had made garbage of whatever was the problem.

I then added it into the array and it worked as before.

However, it still wasn't added when I rebooted.

...but, there is something different. Now, when I --examine /dev/sdi, it gives output for the whole array including 2 spares, which is the end result I expect :

Active Devices : 6
Working Devices : 8
Failed Devices : 0
Spare Devices : 2

However, --detail /dev/md2 still denies /dev/sdi exists :

Active Devices : 6
Working Devices : 7
Failed Devices : 0
Spare Devices : 1

What's up?

Max.

#7 lore raw
Quoted 25 lines · Max Waterman
Quoted 4 lines · Max Waterman
Quoted 3 lines

If that does not work, clean the drive out manually after removing it as a spare from the array:
dd if=/dev/zero of=/dev/sdi bs=1M

This is taking forever

I stopped it after about half an hour, hoping that it had made garbage of whatever was the problem.

I then added it into the array and it worked as before.

However, it still wasn't added when I rebooted.

...but, there is something different. Now, when I --examine /dev/sdi, it gives output for the whole array including 2 spares, which is the end result I expect :

Active Devices : 6
Working Devices : 8
Failed Devices : 0
Spare Devices : 2

However, --detail /dev/md2 still denies /dev/sdi exists :

Active Devices : 6
Working Devices : 7
Failed Devices : 0
Spare Devices : 1

Quoted 9 lines

What's up?

Max.

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

The superblock is at the end of the disk for 0.90.00 superblocks, so you would need to write to end of the disk or just let dd clear out the entire disk. Honestly though that may not fix the root cause of the problem, we may need to wait for others on the list and/or Neil to check this one out. It seems very strange, can you post the regular output that people ask for so once they see your mail, they will have (hopefully) most of what they need to diagnose the problem.

1. mdadm -D /dev/mdX
2. cat /proc/mdstat
3. mdadm -Esvvv
4. uname -a

Justin.

#8 lore raw
Quoted 39 lines · Justin Piszcz
Quoted 20 lines · Max Waterman
Quoted 4 lines · Max Waterman
Quoted 3 lines

If that does not work, clean the drive out manually after removing it as a spare from the array:
dd if=/dev/zero of=/dev/sdi bs=1M

This is taking forever

I stopped it after about half an hour, hoping that it had made garbage of whatever was the problem.

I then added it into the array and it worked as before.

However, it still wasn't added when I rebooted.

...but, there is something different. Now, when I --examine /dev/sdi, it gives output for the whole array including 2 spares, which is the end result I expect :

Active Devices : 6
Working Devices : 8
Failed Devices : 0
Spare Devices : 2

However, --detail /dev/md2 still denies /dev/sdi exists :

Quoted 14 lines

Active Devices : 6
Working Devices : 7
Failed Devices : 0
Spare Devices : 1

What's up?

Max.

Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Quoted 6 lines

The superblock is at the end of the disk for 0.90.00 superblocks, so you would need to write to end of the disk or just let dd clear out the entire disk. Honestly though that may not fix the root cause of the problem, we may need to wait for others on the list and/or Neil to check this one out. It seems very strange, can you post the regular output that people ask for so once they see your mail, they will have (hopefully) most of what they need to diagnose the problem.

1. mdadm -D /dev/mdX
2. cat /proc/mdstat
3. mdadm -Esvvv
4. uname -a

5. mdadm -E /dev/sdi

OK, I uploaded the output of the above commands to here :

<http://reality.sgiweb.org/maxw/tmp/md2Details/>

I hope someone can shed some light on this.

Thanks,

Max.

#9 lore raw

Can no one provide any enlightenment on this issue?

Max.

Quoted 61 lines · Max Waterman
Quoted 39 lines · Justin Piszcz
Quoted 20 lines · Max Waterman
Quoted 4 lines · Max Waterman
Quoted 3 lines

If that does not work, clean the drive out manually after removing it as a spare from the array:
dd if=/dev/zero of=/dev/sdi bs=1M

This is taking forever

I stopped it after about half an hour, hoping that it had made garbage of whatever was the problem.

I then added it into the array and it worked as before.

However, it still wasn't added when I rebooted.

...but, there is something different. Now, when I --examine /dev/sdi, it gives output for the whole array including 2 spares, which is the end result I expect :

Active Devices : 6
Working Devices : 8
Failed Devices : 0
Spare Devices : 2

However, --detail /dev/md2 still denies /dev/sdi exists :

Quoted 14 lines

Active Devices : 6
Working Devices : 7
Failed Devices : 0
Spare Devices : 1

What's up?

Max.

Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Quoted 6 lines

The superblock is at the end of the disk for 0.90.00 superblocks, so you would need to write to end of the disk or just let dd clear out the entire disk. Honestly though that may not fix the root cause of the problem, we may need to wait for others on the list and/or Neil to check this one out. It seems very strange, can you post the regular output that people ask for so once they see your mail, they will have (hopefully) most of what they need to diagnose the problem.

1. mdadm -D /dev/mdX
2. cat /proc/mdstat
3. mdadm -Esvvv
4. uname -a

5. mdadm -E /dev/sdi

OK, I uploaded the output of the above commands to here :

<http://reality.sgiweb.org/maxw/tmp/md2Details/>

I hope someone can shed some light on this.

Thanks,

Max.

Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#10 lore raw

Someone else's post prompted me to try :

$ sudo /sbin/mdadm --detail --scan
ARRAY /dev/md2 level=raid5 num-devices=6 metadata=00.90 spares=2 UUID=15bfec75:595ac793:0914f8ee:862effd8

and use that in mdadm.conf instead of the output of :

~$ sudo /sbin/mdadm --examine --scan
ARRAY /dev/md2 level=raid5 num-devices=6 UUID=15bfec75:595ac793:0914f8ee:862effd8
spares=2

This fixes my problem of the second spare drive not being added. I'm not sure why.

However, mdadm now gives me a 'message' :

mdadm: metadata format 00.90 unknown, ignored.

What's this about? Anything to worry about?

Max.

Quoted 71 lines · Max Waterman

Can no one provide any enlightenment on this issue?

Max.

Quoted 61 lines · Max Waterman
Quoted 39 lines · Justin Piszcz
Quoted 20 lines · Max Waterman
Quoted 4 lines · Max Waterman
Quoted 3 lines

If that does not work, clean the drive out manually after removing it as a spare from the array:
dd if=/dev/zero of=/dev/sdi bs=1M

This is taking forever

I stopped it after about half an hour, hoping that it had made garbage of whatever was the problem.

I then added it into the array and it worked as before.

However, it still wasn't added when I rebooted.

...but, there is something different. Now, when I --examine /dev/sdi, it gives output for the whole array including 2 spares, which is the end result I expect :

Active Devices : 6
Working Devices : 8
Failed Devices : 0
Spare Devices : 2

However, --detail /dev/md2 still denies /dev/sdi exists :

Quoted 14 lines

Active Devices : 6
Working Devices : 7
Failed Devices : 0
Spare Devices : 1

What's up?

Max.

Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Quoted 6 lines

The superblock is at the end of the disk for 0.90.00 superblocks, so you would need to write to end of the disk or just let dd clear out the entire disk. Honestly though that may not fix the root cause of the problem, we may need to wait for others on the list and/or Neil to check this one out. It seems very strange, can you post the regular output that people ask for so once they see your mail, they will have (hopefully) most of what they need to diagnose the problem.

1. mdadm -D /dev/mdX
2. cat /proc/mdstat
3. mdadm -Esvvv
4. uname -a

5. mdadm -E /dev/sdi

OK, I uploaded the output of the above commands to here :

<http://reality.sgiweb.org/maxw/tmp/md2Details/>

I hope someone can shed some light on this.

Thanks,

Max.

Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#11 lore raw
Quoted 13 lines · Max Waterman

Someone else's post prompted me to try :

$ sudo /sbin/mdadm --detail --scan
ARRAY /dev/md2 level=raid5 num-devices=6 metadata=00.90 spares=2
UUID=15bfec75:595ac793:0914f8ee:862effd8

and use that in mdadm.conf instead of the output of :

~$ sudo /sbin/mdadm --examine --scan
ARRAY /dev/md2 level=raid5 num-devices=6
UUID=15bfec75:595ac793:0914f8ee:862effd8
spares=2

Quoted 9 lines

This fixes my problem of the second spare drive not being added. I'm not sure why.

However, mdadm now gives me a 'message' :

mdadm: metadata format 00.90 unknown, ignored.

What's this about? Anything to worry about?

Change it to metadata=0.90 instead of metadata=00.90 & it should work w/out the error message. It would probably be good if mdadm.conf and/or mdadm --detail --scan dropped leading zeros.

Conway S. Smith

#12 lore raw
Quoted 23 lines · Beolach
Quoted 20 lines · Max Waterman

Someone else's post prompted me to try :

$ sudo /sbin/mdadm --detail --scan
ARRAY /dev/md2 level=raid5 num-devices=6 metadata=00.90 spares=2
UUID=15bfec75:595ac793:0914f8ee:862effd8

and use that in mdadm.conf instead of the output of :

~$ sudo /sbin/mdadm --examine --scan
ARRAY /dev/md2 level=raid5 num-devices=6
UUID=15bfec75:595ac793:0914f8ee:862effd8
spares=2

This fixes my problem of the second spare drive not being added. I'm not sure why.

However, mdadm now gives me a 'message' :

mdadm: metadata format 00.90 unknown, ignored.

Quoted 8 lines
Quoted 3 lines

What's this about? Anything to worry about?

Change it to metadata=0.90 instead of metadata=00.90 & it should work w/out the error message. It would probably be good if mdadm.conf and/or mdadm --detail --scan dropped leading zeros.

Yup, that fixed the error.

Any ideas why it didn't work with the output of --examine?

Max.