linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to use replacement?
@ 2012-06-04  1:53 majianpeng
  2012-06-04  2:11 ` NeilBrown
  0 siblings, 1 reply; 4+ messages in thread
From: majianpeng @ 2012-06-04  1:53 UTC (permalink / raw)
  To: Neil Brown; +Cc: linux-raid

Hi:
	At present, md is supporting replacement.
	In function: state_store()
>   } else if (cmd_match(buf, "replacement")) {
>		/* Can only set a device as a replacement when array has not
>		 * yet been started.  Once running, replacement is automatic
>		 * from spares, or by assigning 'slot'.
>		 */
		I can using spare disk.But how to use slot?
>		if (rdev->mddev->pers)
>			err = -EBUSY;
		


--------------
majianpeng

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to use replacement?
  2012-06-04  1:53 How to use replacement? majianpeng
@ 2012-06-04  2:11 ` NeilBrown
  2012-06-04  6:34   ` majianpeng
  0 siblings, 1 reply; 4+ messages in thread
From: NeilBrown @ 2012-06-04  2:11 UTC (permalink / raw)
  To: majianpeng; +Cc: linux-raid

[-- Attachment #1: Type: text/plain, Size: 1105 bytes --]

On Mon, 4 Jun 2012 09:53:21 +0800 majianpeng <majianpeng@gmail.com> wrote:

> Hi:
> 	At present, md is supporting replacement.
> 	In function: state_store()
> >   } else if (cmd_match(buf, "replacement")) {
> >		/* Can only set a device as a replacement when array has not
> >		 * yet been started.  Once running, replacement is automatic
> >		 * from spares, or by assigning 'slot'.
> >		 */
> 		I can using spare disk.But how to use slot?

If you want to ensure that a particular device becomes a replacement for a
particular other device, then
  cd /sys/block/mdX/md
  echo frozen > sync_action
  echo NN:MM > new_dev  # where NN is major and MM is minor of new device
  echo want_replacement > rdSS/state  # where SS is slot number of device to
                          # replace
  echo SS > dev-YYY/slot  # where YYY is the kernel name of the newly added
                          # device
  echo idle > sync_action

should do it, but I haven't tested recently.

NeilBrown


> >		if (rdev->mddev->pers)
> >			err = -EBUSY;
> 		
> 
> 
> --------------
> majianpeng

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Re: How to use replacement?
  2012-06-04  2:11 ` NeilBrown
@ 2012-06-04  6:34   ` majianpeng
  2012-06-04  7:12     ` NeilBrown
  0 siblings, 1 reply; 4+ messages in thread
From: majianpeng @ 2012-06-04  6:34 UTC (permalink / raw)
  To: Neil Brown; +Cc: linux-raid

>On Mon, 4 Jun 2012 09:53:21 +0800 majianpeng <majianpeng@gmail.com> wrote:
>
>> Hi:
>> 	At present, md is supporting replacement.
>> 	In function: state_store()
>> >   } else if (cmd_match(buf, "replacement")) {
>> >		/* Can only set a device as a replacement when array has not
>> >		 * yet been started.  Once running, replacement is automatic
>> >		 * from spares, or by assigning 'slot'.
>> >		 */
>> 		I can using spare disk.But how to use slot?
>
>If you want to ensure that a particular device becomes a replacement for a
>particular other device, then
>  cd /sys/block/mdX/md
>  echo frozen > sync_action
>  echo NN:MM > new_dev  # where NN is major and MM is minor of new device

If the array had a persistent superblock, the operation returned error.
The message like:
[  262.934070] md: sde does not have a valid v1.2 superblock, not importing!
How can do it ?

>  echo want_replacement > rdSS/state  # where SS is slot number of device to
>                          # replace
>  echo SS > dev-YYY/slot  # where YYY is the kernel name of the newly added
>                          # device
>  echo idle > sync_action
>
>should do it, but I haven't tested recently.
>
>NeilBrown


--------------
majianpeng

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to use replacement?
  2012-06-04  6:34   ` majianpeng
@ 2012-06-04  7:12     ` NeilBrown
  0 siblings, 0 replies; 4+ messages in thread
From: NeilBrown @ 2012-06-04  7:12 UTC (permalink / raw)
  To: majianpeng; +Cc: linux-raid

[-- Attachment #1: Type: text/plain, Size: 1185 bytes --]

On Mon, 4 Jun 2012 14:34:28 +0800 majianpeng <majianpeng@gmail.com> wrote:

> >On Mon, 4 Jun 2012 09:53:21 +0800 majianpeng <majianpeng@gmail.com> wrote:
> >
> >> Hi:
> >> 	At present, md is supporting replacement.
> >> 	In function: state_store()
> >> >   } else if (cmd_match(buf, "replacement")) {
> >> >		/* Can only set a device as a replacement when array has not
> >> >		 * yet been started.  Once running, replacement is automatic
> >> >		 * from spares, or by assigning 'slot'.
> >> >		 */
> >> 		I can using spare disk.But how to use slot?
> >
> >If you want to ensure that a particular device becomes a replacement for a
> >particular other device, then
> >  cd /sys/block/mdX/md
> >  echo frozen > sync_action
> >  echo NN:MM > new_dev  # where NN is major and MM is minor of new device
> 
> If the array had a persistent superblock, the operation returned error.
> The message like:
> [  262.934070] md: sde does not have a valid v1.2 superblock, not importing!
> How can do it ?
> 

You need to write a superblock out to the device first.
mdadm already does this when adding a spare to an array, and it is
a similar operation.

NeilBrown


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-06-04  7:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-04  1:53 How to use replacement? majianpeng
2012-06-04  2:11 ` NeilBrown
2012-06-04  6:34   ` majianpeng
2012-06-04  7:12     ` NeilBrown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).