linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* mdadm and automatic re-add / incremental mode with usb-disk
@ 2008-11-30 11:31 Wilhelm Meier
  2008-11-30 11:48 ` Justin Piszcz
  2008-12-01  0:32 ` NeilBrown
  0 siblings, 2 replies; 8+ messages in thread
From: Wilhelm Meier @ 2008-11-30 11:31 UTC (permalink / raw)
  To: linux-raid

Hi,

I'm using debian etch with mdadm 2.5.6-9.

I have a md-device /dev/md1000 with two usb-disks as raid1. The array 
is assembled well if the system boots, if I unplug one of the disks, 
the array goes to degraded. Thats all ok.

If I re-plug the usb-disk, udev discovers the device fine, but mdadm 
doesn't start the re-add to the md-array. I have to do this but hand.

Is there something missing to make this work automatically?

I tried the mdm-2.6.2 from etch-backports too. Same effect.

Here, if I try to use the --incremental mode, it constructs a new (!) 
array /dev/md/d_1000  instead of adding it to /dev/md1000. 
Thats strange to me.

I thought I got it working some weeks ago (maybe with earlier / other 
versions of mdadm or somme missing other tool), but I can't get the 
puzzle right now.

Any hints?
-- 
Wilhelm

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

* Re: mdadm and automatic re-add / incremental mode with usb-disk
  2008-11-30 11:31 mdadm and automatic re-add / incremental mode with usb-disk Wilhelm Meier
@ 2008-11-30 11:48 ` Justin Piszcz
  2008-11-30 13:03   ` Wilhelm Meier
  2008-12-01  0:32 ` NeilBrown
  1 sibling, 1 reply; 8+ messages in thread
From: Justin Piszcz @ 2008-11-30 11:48 UTC (permalink / raw)
  To: Wilhelm Meier; +Cc: linux-raid



On Sun, 30 Nov 2008, Wilhelm Meier wrote:

> Hi,
>
> I'm using debian etch with mdadm 2.5.6-9.
>
> I have a md-device /dev/md1000 with two usb-disks as raid1. The array
> is assembled well if the system boots, if I unplug one of the disks,
> the array goes to degraded. Thats all ok.
>
> If I re-plug the usb-disk, udev discovers the device fine, but mdadm
> doesn't start the re-add to the md-array. I have to do this but hand.
>
> Is there something missing to make this work automatically?
>
> I tried the mdm-2.6.2 from etch-backports too. Same effect.
>
> Here, if I try to use the --incremental mode, it constructs a new (!)
> array /dev/md/d_1000  instead of adding it to /dev/md1000.
> Thats strange to me.
>
> I thought I got it working some weeks ago (maybe with earlier / other
> versions of mdadm or somme missing other tool), but I can't get the
> puzzle right now.
>
> Any hints?
> -- 
> Wilhelm
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

Wilhelm,

As far as I know mdadm never will re-add a broken/failed/disconnected disk 
back into the array.  Perhaps what you saw before is on an un-clean shutdown
or something similar, upon reboot the array is checking/re-initializing.

When you have a failed drive and you re-attach it, it will stay as a 
removed unit and you need to remove it and add it manually as you stated.

Were you seeing something other than this before?

Justin.

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

* Re: mdadm and automatic re-add / incremental mode with usb-disk
  2008-11-30 11:48 ` Justin Piszcz
@ 2008-11-30 13:03   ` Wilhelm Meier
  2008-11-30 13:10     ` Justin Piszcz
  2008-12-01 15:21     ` Mario 'BitKoenig' Holbe
  0 siblings, 2 replies; 8+ messages in thread
From: Wilhelm Meier @ 2008-11-30 13:03 UTC (permalink / raw)
  To: Justin Piszcz; +Cc: linux-raid

Am Sonntag 30 November 2008 schrieb Justin Piszcz:
> On Sun, 30 Nov 2008, Wilhelm Meier wrote:
> > Hi,
> >
> > I'm using debian etch with mdadm 2.5.6-9.
> >
> > I have a md-device /dev/md1000 with two usb-disks as raid1. The
> > array is assembled well if the system boots, if I unplug one of
> > the disks, the array goes to degraded. Thats all ok.
> >
> > If I re-plug the usb-disk, udev discovers the device fine, but
> > mdadm doesn't start the re-add to the md-array. I have to do this
> > but hand.
> >
> > Is there something missing to make this work automatically?
> >
> > I tried the mdm-2.6.2 from etch-backports too. Same effect.
> >
> > Here, if I try to use the --incremental mode, it constructs a new
> > (!) array /dev/md/d_1000  instead of adding it to /dev/md1000.
> > Thats strange to me.
> >
> > I thought I got it working some weeks ago (maybe with earlier /
> > other versions of mdadm or somme missing other tool), but I can't
> > get the puzzle right now.
> >
> > Any hints?
> > --
> > Wilhelm
> > --
> > To unsubscribe from this list: send the line "unsubscribe
> > linux-raid" in the body of a message to majordomo@vger.kernel.org
> > More majordomo info at 
> > http://vger.kernel.org/majordomo-info.html
>
> Wilhelm,
>
> As far as I know mdadm never will re-add a
> broken/failed/disconnected disk back into the array.  Perhaps what
> you saw before is on an un-clean shutdown or something similar,
> upon reboot the array is checking/re-initializing.

That might be, but what is the difference between doing the re-add and 
re-sync on boot (that's what happens!) or if the drive comes back on 
a running system.

mdadm can surely determine the state/uuid and do this - the same as on 
reboot.

> When you have a failed drive and you re-attach it, it will stay as
> a removed unit and you need to remove it and add it manually as you
> stated.

the only thing I have to do is e.g.

mdadm --re-add /dev/md1000 /dev/sdg1

then it starts reconstructing the right way.

So, my thought was to do this as part of a udev-rule. 
But I think this is a common case and therefore there should be a 
well-known solution

> Were you seeing something other than this before?

I might be wrong, but I thought it was on debian ...

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



-- 
Wilhelm

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

* Re: mdadm and automatic re-add / incremental mode with usb-disk
  2008-11-30 13:03   ` Wilhelm Meier
@ 2008-11-30 13:10     ` Justin Piszcz
  2008-11-30 13:52       ` Wilhelm Meier
  2008-12-01 15:21     ` Mario 'BitKoenig' Holbe
  1 sibling, 1 reply; 8+ messages in thread
From: Justin Piszcz @ 2008-11-30 13:10 UTC (permalink / raw)
  To: Wilhelm Meier; +Cc: linux-raid



On Sun, 30 Nov 2008, Wilhelm Meier wrote:

> Am Sonntag 30 November 2008 schrieb Justin Piszcz:
>> On Sun, 30 Nov 2008, Wilhelm Meier wrote:

> That might be, but what is the difference between doing the re-add and
> re-sync on boot (that's what happens!) or if the drive comes back on
> a running system.

From the docs, when you remove and re-add it would appear to be a 'reocover'
whereas an unclean shutdown would be resyncing (or repair if you do not have
a bitmap).

linux-2.6.27.7/Documentation/md.txt (actually a good doc to read btw)

        resync        - redundancy is being recalculated after unclean
                        shutdown or creation
        recover       - a hot spare is being built to replace a
                        failed/missing device
        repair        - A full check and repair is happening.  This is
                        similar to 'resync', but was requested by the
                        user, and the write-intent bitmap is NOT used to
            optimise the process.

>
> mdadm can surely determine the state/uuid and do this - the same as on
> reboot.
>
>> When you have a failed drive and you re-attach it, it will stay as
>> a removed unit and you need to remove it and add it manually as you
>> stated.
>
> the only thing I have to do is e.g.
>
> mdadm --re-add /dev/md1000 /dev/sdg1
>
> then it starts reconstructing the right way.
>
> So, my thought was to do this as part of a udev-rule.
> But I think this is a common case and therefore there should be a
> well-known solution
Yeah I suppose you could do something like this.  Is the purpose more or less
to have a portable raid1 array?

Justin.


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

* Re: mdadm and automatic re-add / incremental mode with usb-disk
  2008-11-30 13:10     ` Justin Piszcz
@ 2008-11-30 13:52       ` Wilhelm Meier
  0 siblings, 0 replies; 8+ messages in thread
From: Wilhelm Meier @ 2008-11-30 13:52 UTC (permalink / raw)
  To: Justin Piszcz; +Cc: linux-raid

Am Sonntag 30 November 2008 schrieb Justin Piszcz:
> On Sun, 30 Nov 2008, Wilhelm Meier wrote:
> > Am Sonntag 30 November 2008 schrieb Justin Piszcz:
> >> On Sun, 30 Nov 2008, Wilhelm Meier wrote:
> >
> > That might be, but what is the difference between doing the
> > re-add and re-sync on boot (that's what happens!) or if the drive
> > comes back on a running system.
>
> From the docs, when you remove and re-add it would appear to be a
> 'reocover' whereas an unclean shutdown would be resyncing (or
> repair if you do not have a bitmap).
>
> linux-2.6.27.7/Documentation/md.txt (actually a good doc to read
> btw)
>
>         resync        - redundancy is being recalculated after
> unclean shutdown or creation
>         recover       - a hot spare is being built to replace a
>                         failed/missing device
>         repair        - A full check and repair is happening.  This
> is similar to 'resync', but was requested by the user, and the
> write-intent bitmap is NOT used to optimise the process.

Oh yes, I mean "recover", thats what is happening after the manual 
re-add if I unplug und then replug the usb-disk.

>
> > mdadm can surely determine the state/uuid and do this - the same
> > as on reboot.
> >
> >> When you have a failed drive and you re-attach it, it will stay
> >> as a removed unit and you need to remove it and add it manually
> >> as you stated.
> >
> > the only thing I have to do is e.g.
> >
> > mdadm --re-add /dev/md1000 /dev/sdg1
> >
> > then it starts reconstructing the right way.
> >
> > So, my thought was to do this as part of a udev-rule.
> > But I think this is a common case and therefore there should be a
> > well-known solution
>
> Yeah I suppose you could do something like this.  Is the purpose
> more or less to have a portable raid1 array?

Yes, exactly.
I want to have a portable usb-raid of 2 disks (or 2x2 with lvm on top) 
and I want to plug and unplug the disks freely.

-- 
Wilhelm

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

* Re: mdadm and automatic re-add / incremental mode with usb-disk
  2008-11-30 11:31 mdadm and automatic re-add / incremental mode with usb-disk Wilhelm Meier
  2008-11-30 11:48 ` Justin Piszcz
@ 2008-12-01  0:32 ` NeilBrown
  2008-12-01  6:46   ` Wilhelm Meier
  1 sibling, 1 reply; 8+ messages in thread
From: NeilBrown @ 2008-12-01  0:32 UTC (permalink / raw)
  To: Wilhelm Meier; +Cc: linux-raid

On Sun, November 30, 2008 10:31 pm, Wilhelm Meier wrote:
> Hi,
>
> I'm using debian etch with mdadm 2.5.6-9.
>
> I have a md-device /dev/md1000 with two usb-disks as raid1. The array
> is assembled well if the system boots, if I unplug one of the disks,
> the array goes to degraded. Thats all ok.
>
> If I re-plug the usb-disk, udev discovers the device fine, but mdadm
> doesn't start the re-add to the md-array. I have to do this but hand.
>
> Is there something missing to make this work automatically?

You would need to put some magic in udev.
Something in /etc/udev/rules.d would need to do something like
 RUN+="/sbin/mdadm -I ..the..device.name"

if the detected device was one that you want to be added to an array.
I have tried this yet so I don't know the details of how to make it
work.


>
> I tried the mdm-2.6.2 from etch-backports too. Same effect.
>
> Here, if I try to use the --incremental mode, it constructs a new (!)
> array /dev/md/d_1000  instead of adding it to /dev/md1000.
> Thats strange to me.

--incremental only works properly if the array was created by
--incremental.  You might be able to make it work better by
running
   mdadm -Ir

first.  This recreates /var/run/mdadm/map.


Good luck!

NeilBrown


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

* Re: mdadm and automatic re-add / incremental mode with usb-disk
  2008-12-01  0:32 ` NeilBrown
@ 2008-12-01  6:46   ` Wilhelm Meier
  0 siblings, 0 replies; 8+ messages in thread
From: Wilhelm Meier @ 2008-12-01  6:46 UTC (permalink / raw)
  To: NeilBrown; +Cc: linux-raid

Am Montag 01 Dezember 2008 schrieb NeilBrown:
> On Sun, November 30, 2008 10:31 pm, Wilhelm Meier wrote:
> > Hi,
> >
> > I'm using debian etch with mdadm 2.5.6-9.
> >
> > I have a md-device /dev/md1000 with two usb-disks as raid1. The
> > array is assembled well if the system boots, if I unplug one of
> > the disks, the array goes to degraded. Thats all ok.
> >
> > If I re-plug the usb-disk, udev discovers the device fine, but
> > mdadm doesn't start the re-add to the md-array. I have to do this
> > but hand.
> >
> > Is there something missing to make this work automatically?
>
> You would need to put some magic in udev.
> Something in /etc/udev/rules.d would need to do something like
>  RUN+="/sbin/mdadm -I ..the..device.name"

Yes, I tried that and it works half-the-way: as I wrote in another 
posting, mdadm -I does not allow the -c configfile option. Because I 
use a different config for a special set of devices, mdadm -I does 
not know the uuid's of the arrays of this special config file and 
therefore creates a new array with a different naming scheme (and 
different major/minor dev-numbers) (see below).

>
> if the detected device was one that you want to be added to an
> array. I have tried this yet so I don't know the details of how to
> make it work.
>
> > I tried the mdm-2.6.2 from etch-backports too. Same effect.
> >
> > Here, if I try to use the --incremental mode, it constructs a new
> > (!) array /dev/md/d_1000  instead of adding it to /dev/md1000.
> > Thats strange to me.
>
> --incremental only works properly if the array was created by
> --incremental.  

Thats a point I don't understand. 
Should I use --increment instead of normal creation and 
later --assemble? 
Why is this different?
Can this work together, I mean: can I --assemble arrays (as most 
distros do that on boot) and later --incremental create/reconstruct 
other arrays?

> You might be able to make it work better by 
> running
>    mdadm -Ir
>
> first.  This recreates /var/run/mdadm/map.

-- 
Wilhelm

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

* Re: mdadm and automatic re-add / incremental mode with usb-disk
  2008-11-30 13:03   ` Wilhelm Meier
  2008-11-30 13:10     ` Justin Piszcz
@ 2008-12-01 15:21     ` Mario 'BitKoenig' Holbe
  1 sibling, 0 replies; 8+ messages in thread
From: Mario 'BitKoenig' Holbe @ 2008-12-01 15:21 UTC (permalink / raw)
  To: linux-raid

Wilhelm Meier <wilhelm.meier@fh-kl.de> wrote:
> That might be, but what is the difference between doing the re-add and 
> re-sync on boot (that's what happens!)

Nope, that's not what happens. What happens is a re-sync, not a re-add.
Drives are never automagically re-added to an array. Once arrays are so
far out of sync that a re-add is needed, you always have to do it
manually, reboot or not.

> or if the drive comes back on a running system.

The drive could be buggy, could have a buggy connection, whatever. The
reason for a drive disappearing and re-appearing is not always a user
plugging it out and in.

> So, my thought was to do this as part of a udev-rule. 

Of course, you can do this yourself via some scripting. And if you think
it is safe for you, move on. But then you have no reason to cry once
those automatisms broke your system :)


regards
   Mario
-- 
The problem in the world today is communication. Too much communication.
                                                     -- Homer J. Simpson


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

end of thread, other threads:[~2008-12-01 15:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-30 11:31 mdadm and automatic re-add / incremental mode with usb-disk Wilhelm Meier
2008-11-30 11:48 ` Justin Piszcz
2008-11-30 13:03   ` Wilhelm Meier
2008-11-30 13:10     ` Justin Piszcz
2008-11-30 13:52       ` Wilhelm Meier
2008-12-01 15:21     ` Mario 'BitKoenig' Holbe
2008-12-01  0:32 ` NeilBrown
2008-12-01  6:46   ` Wilhelm Meier

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).