linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Hot adding active disk to RAID1?
@ 2004-02-07 15:29 Mike Perry
  2004-02-07 17:37 ` Mike Perry
  0 siblings, 1 reply; 10+ messages in thread
From: Mike Perry @ 2004-02-07 15:29 UTC (permalink / raw)
  To: linux-raid

Well, this is probably a FAQ, but I've really looked around and can't
seem to find how to do it..

So here's the story: I just created a RAID1 array. I did this by simply
creating a single disk array, and then copying the data from the
original disk onto the array, and then trying to raidhotadd the original
disk once the array was created and the contents fully copied. I did NOT
use a failed-disk directive for the original disk, as I have had at
least one experience where the failed-disk directive was ignored and
that drive was mirrored to anyways.. Luckily the failed-disk had no
important data on it that time, but I didn't want to risk it this time..

At any rate, now it seems that my hotadded disk is NOT part of the
active array, but is in fact a spare. Here's the relevant lines from
mdadm --detail /dev/md0

	Raid Disks : 1
	Total Disks : 2
	Preferred Minor : 0
	
	Active Drives : 1
	Working Drives : 2
	Failed Drives : 0
	Spare Drives : 1

It should be a simple matter to convert that spare to an active drive,
right? Especially for RAID1. How do I go about doing that? 

I've found a tool called raidreconf by the author of the RAID HOWTO, but
I'm reluctant to just run that and hope for the best, especially since
it seems to be written for just RAID0 and 5 (the rather scant manpage
makes no mention of RAID1 whatsoever). 

Does anyone have any experience with using raidreconf for RAID1, or have
a way to hotadd a disk and have it become active, instead of being a
spare?


-- 
Mike Perry
Mad Computer Scientist
fscked.org evil labs

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

* Re: Hot adding active disk to RAID1?
  2004-02-07 15:29 Hot adding active disk to RAID1? Mike Perry
@ 2004-02-07 17:37 ` Mike Perry
  2004-02-07 18:01   ` Måns Rullgård
  2004-02-07 18:23   ` Peter Sjöberg
  0 siblings, 2 replies; 10+ messages in thread
From: Mike Perry @ 2004-02-07 17:37 UTC (permalink / raw)
  To: linux-raid

Thus spake Mike Perry (mikepery@fscked.org):

> Well, this is probably a FAQ, but I've really looked around..
> Does anyone have any experience with using raidreconf for RAID1, or have
> a way to hotadd a disk and have it become active, instead of being a
> spare?

Ok, in my impatience I grew some balls.. As it turns out, the RAID1
superblock is (seemingly?) independent of the contents of the volume. So
I was able to simply mkraid --force /dev/md0, this time WITH a
failed-disk directive. Once this was done, I was able to mount /dev/md0
right away, no reformatting or anything needed.

Then I hot-added the failed-disk, and it seems to be synching properly.

And also this time the failed-disk wasn't mirrored to immediately either
(ie without the explicit hotadd).. I wonder why that happened the last
time I did this.. Maybe I just miswrote the raidtab on that occasion..
Or possibly the partition type was raid autodetect and after the reboot
the md driver saw this and decided to start mirroring, regardless of
raidtab?

Anyways, sorry for the spam, but I imagine at least one other poor sap
out there will find this useful ;)

P.S. I also looked at the src for raidreconf.. it in fact only supports
raid0 and 5, and seems to be nice enough to refuse to do anything if you
have a different raid level. So they got that going for them, which is
nice.

-- 
Mike Perry
Mad Computer Scientist
fscked.org evil labs

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

* Re: Hot adding active disk to RAID1?
  2004-02-07 17:37 ` Mike Perry
@ 2004-02-07 18:01   ` Måns Rullgård
  2004-02-07 18:23   ` Peter Sjöberg
  1 sibling, 0 replies; 10+ messages in thread
From: Måns Rullgård @ 2004-02-07 18:01 UTC (permalink / raw)
  To: linux-raid

Mike Perry <mikepery@fscked.org> writes:

> Thus spake Mike Perry (mikepery@fscked.org):
>
>> Well, this is probably a FAQ, but I've really looked around..
>> Does anyone have any experience with using raidreconf for RAID1, or have
>> a way to hotadd a disk and have it become active, instead of being a
>> spare?
>
> Ok, in my impatience I grew some balls.. As it turns out, the RAID1
> superblock is (seemingly?) independent of the contents of the volume. So
> I was able to simply mkraid --force /dev/md0, this time WITH a
> failed-disk directive. Once this was done, I was able to mount /dev/md0
> right away, no reformatting or anything needed.

Yes, the superblock is written at the end of the disk.  Writing a
superblock doesn't touch the data.

> Then I hot-added the failed-disk, and it seems to be synching properly.
>
> And also this time the failed-disk wasn't mirrored to immediately either
> (ie without the explicit hotadd).. I wonder why that happened the last
> time I did this.. Maybe I just miswrote the raidtab on that occasion..
> Or possibly the partition type was raid autodetect and after the reboot
> the md driver saw this and decided to start mirroring, regardless of
> raidtab?

I use mdadm for managing my RAID.  When creating a new array it lets
you specify "missing" instead of a device to create an array with
failed disks.  No risk of overwriting anything there.

-- 
Måns Rullgård
mru@kth.se

-
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

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

* Re: Hot adding active disk to RAID1?
  2004-02-07 17:37 ` Mike Perry
  2004-02-07 18:01   ` Måns Rullgård
@ 2004-02-07 18:23   ` Peter Sjöberg
  2004-02-10  7:54     ` Mike Perry
  1 sibling, 1 reply; 10+ messages in thread
From: Peter Sjöberg @ 2004-02-07 18:23 UTC (permalink / raw)
  To: Mike Perry; +Cc: linux-raid

On Sat, 2004-02-07 at 12:37, Mike Perry wrote:
> Thus spake Mike Perry (mikepery@fscked.org):
> 
> > Well, this is probably a FAQ, but I've really looked around..
> > Does anyone have any experience with using raidreconf for RAID1, or have
> > a way to hotadd a disk and have it become active, instead of being a
> > spare?
> 
> Ok, in my impatience I grew some balls.. As it turns out, the RAID1
> superblock is (seemingly?) independent of the contents of the volume. So
> I was able to simply mkraid --force /dev/md0, this time WITH a
> failed-disk directive. Once this was done, I was able to mount /dev/md0
> right away, no reformatting or anything needed.
> 
> Then I hot-added the failed-disk, and it seems to be synching properly.
> 
> And also this time the failed-disk wasn't mirrored to immediately either
> (ie without the explicit hotadd).. I wonder why that happened the last
> time I did this.. Maybe I just miswrote the raidtab on that occasion..
> Or possibly the partition type was raid autodetect and after the reboot
> the md driver saw this and decided to start mirroring, regardless of
> raidtab?
> 
> Anyways, sorry for the spam, but I imagine at least one other poor sap
> out there will find this useful ;)
I'm that one.
I ended up at the same place but for another reason. I was in a hurry to
build my system and knew that converting a ext3 to raid would cause some
problem because of some extra raid info, so I defined a raid1 with only
one disk. Later I bought the other disk and tried to add it by changing
/etc/raidtab but that did of course not work and it was at this point I
started to actually read the doc...
I saw reference to an old version of mkraid that would reinitialize the
superblock only (--superblock-only) and keep the data, but newer
raidtools doesn't do that. If that been there or some manpage in the
later version describing it a bit clearer I could dear to do mkraid -f
but with all incarnations of the raid software I no longer know what is
safe in my version.

My current state is that I have root mounted as /dev/md0 created with
one disk (/dev/hda5) as disk 0. I have since then added another disk and
partitioned it equal. I now want to add /dev/hdc5 to md0 (was never
mentioned before). If I add that to raidtab as failed-disk and do
"mkraid -f", will I loose anything?


> 
> P.S. I also looked at the src for raidreconf.. it in fact only supports
> raid0 and 5, and seems to be nice enough to refuse to do anything if you
> have a different raid level. So they got that going for them, which is
> nice.
-- 
-------------------------------------------------------------------
Techwiz, Peter Sjoberg    PGP key (12F506C8) on keyserver & homepage
Key fingerprint =  3DC2 CEBA 1590 B41A 3780  955A DB42 02BB 12F5 06C8
mailto:peters AT techwiz.ca http://www.techwiz.ca/~peters



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

* Re: Hot adding active disk to RAID1?
  2004-02-07 18:23   ` Peter Sjöberg
@ 2004-02-10  7:54     ` Mike Perry
  2004-02-10  8:22       ` Neil Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Mike Perry @ 2004-02-10  7:54 UTC (permalink / raw)
  To: linux-raid


Thus spake Peter Sj?berg (peters@techwiz.ca):

> On Sat, 2004-02-07 at 12:37, Mike Perry wrote:
> > Thus spake Mike Perry (mikepery@fscked.org):
> > Anyways, sorry for the spam, but I imagine at least one other poor sap
> > out there will find this useful ;)
> I'm that one.
> I ended up at the same place but for another reason. I was in a hurry to
> build my system and knew that converting a ext3 to raid would cause some
> problem because of some extra raid info, so I defined a raid1 with only
> one disk. Later I bought the other disk and tried to add it by changing
> /etc/raidtab but that did of course not work and it was at this point I
> started to actually read the doc...

Yeah, this sounds like my exact scenario, give or take a few details.

> I saw reference to an old version of mkraid that would reinitialize the
> superblock only (--superblock-only) and keep the data, but newer
> raidtools doesn't do that. If that been there or some manpage in the
> later version describing it a bit clearer I could dear to do mkraid -f
> but with all incarnations of the raid software I no longer know what is
> safe in my version

I concur. The manpages really should clear up that raidhotadd (and mdadm
-a) only add spares. And they should further clarify that spares are
essentially useless and lie dormant.. The names of these
commands/options are very deceptive to the new user...

> My current state is that I have root mounted as /dev/md0 created with
> one disk (/dev/hda5) as disk 0. I have since then added another disk and
> partitioned it equal. I now want to add /dev/hdc5 to md0 (was never
> mentioned before). If I add that to raidtab as failed-disk and do
> "mkraid -f", will I loose anything?

I would put your data on both just in case. But yes, this should work
just fine. The sync should start as soon as you raidhotadd a failed
disk.


Sorry for the late reply.. Was away for the weekend (which was the cause
of my original impatience and need to quickly find a solution..) 

-- 
Mike Perry
Mad Computer Scientist
fscked.org evil labs

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

* Re: Hot adding active disk to RAID1?
  2004-02-10  7:54     ` Mike Perry
@ 2004-02-10  8:22       ` Neil Brown
  2004-02-10 15:00         ` Mike Perry
  0 siblings, 1 reply; 10+ messages in thread
From: Neil Brown @ 2004-02-10  8:22 UTC (permalink / raw)
  To: Mike Perry; +Cc: linux-raid

On Tuesday February 10, mikepery@fscked.org wrote:
> 
> I concur. The manpages really should clear up that raidhotadd (and mdadm
> -a) only add spares. And they should further clarify that spares are
> essentially useless and lie dormant.. The names of these
> commands/options are very deceptive to the new user...

Patches are more that welcome.
It is very hard for someone how knows the system "inside-out" to see
which areas aren't explained well.

NeilBrown


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

* Re: Hot adding active disk to RAID1?
  2004-02-10  8:22       ` Neil Brown
@ 2004-02-10 15:00         ` Mike Perry
  2004-02-10 22:30           ` Neil Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Mike Perry @ 2004-02-10 15:00 UTC (permalink / raw)
  To: linux-raid

Thus spake Neil Brown (neilb@cse.unsw.edu.au):

> On Tuesday February 10, mikepery@fscked.org wrote:
> > 
> > I concur. The manpages really should clear up that raidhotadd (and mdadm
> > -a) only add spares. And they should further clarify that spares are
> > essentially useless and lie dormant.. The names of these
> > commands/options are very deceptive to the new user...
> 
> Patches are more that welcome.

Is there a preferred version/cvs repository that I should diff against? The
raidtools are kinda helter-skelter in their net presence, it seems..

> It is very hard for someone how knows the system "inside-out" to see
> which areas aren't explained well.

Heh, ok. I'll put it on the TODO pile.

-- 
Mike Perry
Mad Computer Scientist
fscked.org evil labs

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

* Re: Hot adding active disk to RAID1?
  2004-02-10 15:00         ` Mike Perry
@ 2004-02-10 22:30           ` Neil Brown
  2004-02-11  1:47             ` Hot adding active disk to RAID1? [PATCH] Mike Perry
  0 siblings, 1 reply; 10+ messages in thread
From: Neil Brown @ 2004-02-10 22:30 UTC (permalink / raw)
  To: Mike Perry; +Cc: linux-raid

On Tuesday February 10, mikepery@fscked.org wrote:
> Thus spake Neil Brown (neilb@cse.unsw.edu.au):
> 
> > On Tuesday February 10, mikepery@fscked.org wrote:
> > > 
> > > I concur. The manpages really should clear up that raidhotadd (and mdadm
> > > -a) only add spares. And they should further clarify that spares are
> > > essentially useless and lie dormant.. The names of these
> > > commands/options are very deceptive to the new user...
> > 
> > Patches are more that welcome.
> 
> Is there a preferred version/cvs repository that I should diff against? The
> raidtools are kinda helter-skelter in their net presence, it seems..

Sorry, I should have been more specific.
Patches *against mdadm* are welcome.
I have no interest in "raid-tools" - it seems to be unmaintained.
Patches against the lastest source tar-ball are fine.

NeilBrown

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

* Re: Hot adding active disk to RAID1? [PATCH]
  2004-02-10 22:30           ` Neil Brown
@ 2004-02-11  1:47             ` Mike Perry
  2004-02-15 23:40               ` Neil Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Mike Perry @ 2004-02-11  1:47 UTC (permalink / raw)
  To: Neil Brown; +Cc: linux-raid

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

Thus spake Neil Brown (neilb@cse.unsw.edu.au):

> > Is there a preferred version/cvs repository that I should diff against? The
> > raidtools are kinda helter-skelter in their net presence, it seems..
> 
> Sorry, I should have been more specific.
> Patches *against mdadm* are welcome.
> I have no interest in "raid-tools" - it seems to be unmaintained.
> Patches against the lastest source tar-ball are fine.

Attached. Any plans to port that raidreconf tool into mdadm? Cause for
now, the new manpage refers people to the deprecated raidtools.

-- 
Mike Perry
Mad Computer Scientist
fscked.org evil labs

[-- Attachment #2: man.diff --]
[-- Type: text/plain, Size: 850 bytes --]

--- mdadm.8.old	Tue Feb 10 19:19:00 2004
+++ mdadm.8	Tue Feb 10 19:44:18 2004
@@ -363,7 +363,16 @@
 .TP
 .BR -a ", " --add
 '''add, or
-hotadd listed devices.
+hotadd listed devices as spare disks. 
+
+To add active disks to an array, you will need to recreate the array. If it is
+RAID1, you can often get away with recreating the array using the same
+devices, plus one more, without destroying data (creating a RAID1 device only
+overwrites the superblock).  Note that backing up the array to a regular file
+system on your new disk first is strongly recommended, but if all goes well,
+you should not have to recopy any more data. For RAID0 and RAID5, adding
+active disks will require a raid-tools 1.0 utility called raidreconf. Please
+be aware that there are risks involved with these tools, and plan accordingly.
 
 .TP
 .BR -r ", " --remove

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

* Re: Hot adding active disk to RAID1? [PATCH]
  2004-02-11  1:47             ` Hot adding active disk to RAID1? [PATCH] Mike Perry
@ 2004-02-15 23:40               ` Neil Brown
  0 siblings, 0 replies; 10+ messages in thread
From: Neil Brown @ 2004-02-15 23:40 UTC (permalink / raw)
  To: Mike Perry; +Cc: linux-raid

On Tuesday February 10, mikepery@fscked.org wrote:
> Thus spake Neil Brown (neilb@cse.unsw.edu.au):
> 
> > > Is there a preferred version/cvs repository that I should diff against? The
> > > raidtools are kinda helter-skelter in their net presence, it seems..
> > 
> > Sorry, I should have been more specific.
> > Patches *against mdadm* are welcome.
> > I have no interest in "raid-tools" - it seems to be unmaintained.
> > Patches against the lastest source tar-ball are fine.
> 
> Attached. Any plans to port that raidreconf tool into mdadm? Cause for
> now, the new manpage refers people to the deprecated raidtools.

Thanks, though I'm not sure I want to mention raidreconf there.  Maybe
in a "see also" section.

I have thought about adding raidreconf functionality, but I think I'm
more included to put it in the kernel, so you can reconfigure a live
array.

I've just been testing some new that
a/ allows you to upgrade your raid1/5 to bigger drives on-line.
    i.e. one at a time you
        fail a drive, remove it, plug in a larger drive, and hot add
	it.
     Once all the drives are larger, you can now tell the kernel to
     use the extra space.
b/ add/remove live drives from a raid1.  It will automatically rebuild
   onto an added drive, but won't automatically make a removed drive a
   spare yet (you can only reduce the size of a raid1 if the highest
   numbered slot is empty).  So there is still a bit more work to do.

resizing a raid5 online wouldn't be too hard providing the chunk size
isn't too big. but I'm not in any great hurry to do it just yet.
(Converting raid0 to raid4, and then reshaping to raid5 would be
interesting too :-)

NeilBrown

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

end of thread, other threads:[~2004-02-15 23:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-07 15:29 Hot adding active disk to RAID1? Mike Perry
2004-02-07 17:37 ` Mike Perry
2004-02-07 18:01   ` Måns Rullgård
2004-02-07 18:23   ` Peter Sjöberg
2004-02-10  7:54     ` Mike Perry
2004-02-10  8:22       ` Neil Brown
2004-02-10 15:00         ` Mike Perry
2004-02-10 22:30           ` Neil Brown
2004-02-11  1:47             ` Hot adding active disk to RAID1? [PATCH] Mike Perry
2004-02-15 23:40               ` Neil Brown

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