Skip to contentSkip to conversation

telling mdadm to use spare drive.

DISCUSSION Janek Kozicki 4 participants 11 messages Nov 4, 2007 – Nov 9, 2007 MD RAID

lore
Share & tools
lore
#0 lore raw

Hi,

I finished copying all data from old disc hdc to my shiny new RAID5 array (/dev/hda3 /dev/sda3 missing). Next step is to create a partition on hdc and add it to the array. And so I did this:

# mdadm --add /dev/md1 /dev/hdc3

But then I had a problem - the /dev/hdc3 was a spare, it didn't resync automatically:

# mdadm -D /dev/md1
[....]
    Number   Major   Minor   RaidDevice State
       0       3        3        0      active sync   /dev/hda3
       1       8        3        1      active sync   /dev/sda3
       2       0        0        2      removed

3 22 3 - spare /dev/hdc3

I wanted to tell mdadm to use the spare device, and I wasn't sure how to do this, so I tried following:

# mdadm --stop /dev/md1
# mdadm --assemble --update=resync /dev/md1 /dev/hda3 /dev/sda3 /dev/hdc3

Now, 'mdadm -D /dev/md1' says:
[...]
Number Major Minor RaidDevice State
0 3 3 0 active sync /dev/hda3
1 8 3 1 active sync /dev/sda3
3 22 3 2 spare rebuilding /dev/hdc3

I'm writing here just because I want to be sure that I added this new device correctly, I don't want to make any stupid mistake here...

# cat /proc/mdstat

md1 : active raid5 hda3[0] hdc3[3] sda3[1]

      966807296 blocks super 1.1 level 5, 128k chunk, algorithm 2 [3/2] [UU_]
      [=>...................]  recovery =  6.2% (30068096/483403648) finish=254.9min speed=29639K/sec
      bitmap: 8/8 pages [32KB], 32768KB chunk

Was there a better way to do this, is it OK?

Signature · 1 line
Janek Kozicki                                                         |
#1 lore raw

man mdadm - suggested correction.

Hello,

I did read 'man mdadm' from top to bottom, but I totally forgot to look into /usr/share/doc/mdadm !

And there is much more - FAQs, recipes, etc!

Can you please add do the manual under 'SEE ALSO' a reference to /usr/share/doc/mdadm ?

thanks :-)

Signature · 1 line
Janek Kozicki                                                         |
#3 lore raw

man mdadm - suggested correction.

In reply to Janek Kozicki

Hello,

I did read 'man mdadm' from top to bottom, but I totally forgot to look into /usr/share/doc/mdadm !

And there is much more - FAQs, recipes, etc!

Can you please add to the manual under 'SEE ALSO' a reference to /usr/share/doc/mdadm ?

thanks :-)

Signature · 1 line
Janek Kozicki                                                         |
#4 lore raw

Re: man mdadm - suggested correction.

Janek Kozicki said: (by the date of Mon, 5 Nov 2007 11:58:15 +0100)

Quoted 2 lines

I did read 'man mdadm' from top to bottom, but I totally forgot to look into /usr/share/doc/mdadm !

PS: this why I asked so much questions on this list ;-)

Signature · 1 line
Janek Kozicki                                                         |
#2 lore raw

Re: man mdadm - suggested correction.

In reply to Janek Kozicki

Janek Kozicki wrote:
[]

Quoted 2 lines

Can you please add do the manual under 'SEE ALSO' a reference to /usr/share/doc/mdadm ?

/usr/share/doc/mdadm is Debian-specific (well.. not sure it's really Debian (or something derived from it) -- some other distros may use the same naming scheme, too). Other distributions may place the files into a different directory, or not ship them at all, or ship them in alternative package.

In any case, say, on Debian a user always knows that other misc. docs are in /usr/share/doc/$package - even if no other links are provided in the manpage. Users familiar with other distributions knows where/how to find other docs there.

/mjt

#5 lore raw
In reply to Janek Kozicki
Quoted 10 lines · Janek Kozicki

Hi,

I finished copying all data from old disc hdc to my shiny new RAID5 array (/dev/hda3 /dev/sda3 missing). Next step is to create a partition on hdc and add it to the array. And so I did this:

# mdadm --add /dev/md1 /dev/hdc3

But then I had a problem - the /dev/hdc3 was a spare, it didn't resync automatically:

Strange. That is exactly how I always do it and it always just worked. mdadm should start syncing on any spare as soon as a disk fails or you add the spare to a degraded array afaik. No special "start now" interaction needed.

MfG
Goswin

#6 lore raw

Goswin von Brederlow said: (by the date of Wed, 07 Nov 2007 10:17:51 +0100)

Quoted 4 lines

Strange. That is exactly how I always do it and it always just worked. mdadm should start syncing on any spare as soon as a disk fails or you add the spare to a degraded array afaik. No special "start now" interaction needed.

Thanks for your confirmation. I cannot explain this behaviour - I just started using mdadm. If anybody here wants, I can remove the drive and add this again, to see if I can duplicate this "bug" (?). If so - then tell me what debug information you do need and I will give it to you.

Anyway, it seems that this command

  mdadm --assemble --update=resync /dev/md1 /dev/hda3 /dev/sda3 /dev/hdc3

worked, becasue mdadm -D /dev/md1 says that array is in "State : active" (not degraded).

best regards

Signature · 1 line
Janek Kozicki                                                         |
#7 lore raw
Quoted 9 lines · Janek Kozicki

Goswin von Brederlow said: (by the date of Wed, 07 Nov 2007 10:17:51 +0100)

Quoted 4 lines

Strange. That is exactly how I always do it and it always just worked. mdadm should start syncing on any spare as soon as a disk fails or you add the spare to a degraded array afaik. No special "start now" interaction needed.

Quoted 5 lines

Thanks for your confirmation. I cannot explain this behaviour - I just started using mdadm. If anybody here wants, I can remove the drive and add this again, to see if I can duplicate this "bug" (?). If so - then tell me what debug information you do need and I will give it to you.

What kernel and RAID level is this?

If it's RAID 1, I seem to recall there was a relatively recently fixed bug for this.

Regards,

Richard

#8 lore raw

Richard Scobie said: (by the date of Thu, 08 Nov 2007 08:13:19 +1300)

Quoted 4 lines

What kernel and RAID level is this?

If it's RAID 1, I seem to recall there was a relatively recently fixed bug for this.

debian etch, stock install
Linux 2.6.18-5-k7 #1 SMP i686 GNU/Linux

The problem was with was RAID 5.

But also I have RAID 1 there, and after --add the drives automatically resynced.

Signature · 1 line
Janek Kozicki                                                         |
#9 lore raw
Quoted 8 lines · Janek Kozicki

Richard Scobie said: (by the date of Thu, 08 Nov 2007 08:13:19 +1300)

Quoted 3 lines

What kernel and RAID level is this?

If it's RAID 1, I seem to recall there was a relatively recently fixed bug for this.

Quoted 8 lines

debian etch, stock install
Linux 2.6.18-5-k7 #1 SMP i686 GNU/Linux

The problem was with was RAID 5.

But also I have RAID 1 there, and after --add the drives automatically resynced.

OK.

This was the bug I was thinking of:

http://marc.info/?l=linux-raid&m=116003247912732&w=2

Regards,

Richard

#10 lore raw

Richard Scobie said: (by the date of Fri, 09 Nov 2007 10:32:08 +1300)

Quoted 3 lines

This was the bug I was thinking of:

http://marc.info/?l=linux-raid&m=116003247912732&w=2

This bug says that it only with mdadm 1.x:

"If a drive is added to a raid1 using older tools
(mdadm-1.x or raidtools) then it will be included in the array without any resync happening."

But I have here:

# mdadm --version
mdadm - v2.5.6 - 9 November 2006

maybe I stumbled on another bug?

Signature · 1 line
Janek Kozicki                                                         |