Skip to contentSkip to conversation

How to use replacement?

DISCUSSION majianpeng 2 participants 4 messages Jun 4, 2012 MD RAID

lore
Share & tools
lore

majianpeng

author
#0 lore raw

Hi:
At present, md is supporting replacement.
In function: state_store()

Quoted 5 lines
  } 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?

Quoted 2 lines
		if (rdev->mddev->pers)
			err = -EBUSY;

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

#1 lore raw
Quoted 9 lines · On Mon, 4 Jun 2012 09:53:21 +0800 majianpeng <[email protected]> wrote:

Hi:
At present, md is supporting replacement.
In function: state_store()

Quoted 5 lines
  } 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

Quoted 7 lines
Quoted 2 lines
		if (rdev->mddev->pers)
			err = -EBUSY;

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

author
#2 lore raw
Quoted 10 lines · On Mon, 4 Jun 2012 09:53:21 +0800 majianpeng <[email protected]> wrote:
Quoted 9 lines

Hi:
At present, md is supporting replacement.
In function: state_store()

Quoted 5 lines
  } 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'.
		 */
Quoted 7 lines
Quoted 1 line

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 ?

Quoted 9 lines

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

#3 lore raw
Quoted 18 lines · On Mon, 4 Jun 2012 14:34:28 +0800 majianpeng <[email protected]> wrote:
Quoted 10 lines · On Mon, 4 Jun 2012 09:53:21 +0800 majianpeng <[email protected]> wrote:
Quoted 9 lines

Hi:
At present, md is supporting replacement.
In function: state_store()

Quoted 5 lines
  } 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'.
		 */
Quoted 7 lines
Quoted 1 line

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

Quoted 5 lines

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