linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wayne Gemmell <wayne@flashmedia.co.za>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: linux-raid@vger.kernel.org
Subject: Re: Online resize
Date: Wed, 12 Mar 2008 13:17:08 +0200	[thread overview]
Message-ID: <200803121317.09206.wayne@flashmedia.co.za> (raw)
In-Reply-To: <47D7A491.9020205@msgid.tls.msk.ru>

On Wednesday 12 March 2008 11:38:25 Michael Tokarev wrote:
> Wayne Gemmell wrote:
> > On Wednesday 12 March 2008 10:04:56 you wrote:
> >> a) re-create the array with new partitions, with THE SAME DISK ORDER,
> >>    METADATA VERSION AND CHUNK SIZE as it was before.
> >
> > Is this possible without loosing data?
>
> Yes.  But it's unreliable, sorta.  Too easy to screw things up, that is.
Thankfully I didn't need to do this. Resizing the partitions fixed that.
And now for the dangerous (looking) part.

> And now, the original question comes up again: what to do, how to
> perform the actual resize of the raid array...
>
> To be fair, I don't really know.  I always used my own tiny program
> to assist me in a situation like this - to back up and restore
> v0.90 linux raid superblocks.  It's available at
> http://www.corpit.ru/mjt/mdsuper.c .  Here's how I use it:
>
> First, save the original superblocks in files:
>
>   for f in sd{a,b,c,d,e}1; do
>     ./mdsuper read /dev/$f > $f
>   done
>
> this instructs mdsuper to read the superblock (v0.90 only!) and
> write it to standard out.  This has to be done while the array
> (on original partitions) is STOPPED.
>
> Now, resize the partitions, reboot if necessary (for the kernel
> to recognize the new sizes).  You can save a dump of your current
> partitions using `sfdisk -d' (redirect its output to a file as
> with mdsuper) - just in case if something goes wrong.
>
> At this point, your array is unaccessible - mdadm will tell you
> that it can't find the superblocks.  But we have the superblocks
> saved - so we only need to restore them back:
>
>   for f in sd{a,b,c,d,e}1; do
>     ./mdsuper write /dev/$f < $f
>   done
>
> (note the redirection is opposite!, and read was changed to write!).
>
> Now, try to assemble the array - it should be here.  We just moved
> (actually copied) the superblock from the now-middle-of-partitions
> to the end, where it should be, and mdadm is now able to find it.
> The array is still of the old size - but now mdadm --grow will
> work.
>
> That's basically it.  Just watch the mdsuper invocation.
>
> /mjt
> --
> 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



-- 
Regards
Wayne Gemmell
Flash Media Group
Tel:	27 (0)12 430 7597
Cell:	27 (0)83 666 3342

  reply	other threads:[~2008-03-12 11:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-11  9:19 Online resize Wayne Gemmell
2008-03-11 11:12 ` Robin Hill
2008-03-11 12:44   ` Wayne Gemmell
2008-03-11 14:58     ` Robin Hill
2008-03-12  7:27       ` Wayne Gemmell
2008-03-12  7:46         ` Wayne Gemmell
2008-03-12  8:04       ` Michael Tokarev
2008-03-12  9:14         ` Wayne Gemmell
2008-03-12  9:38           ` Michael Tokarev
2008-03-12 11:17             ` Wayne Gemmell [this message]
2008-03-12  9:31         ` Robin Hill
2008-04-29  1:00 ` Neil Brown
2008-04-29  7:30   ` Wayne Gemmell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200803121317.09206.wayne@flashmedia.co.za \
    --to=wayne@flashmedia.co.za \
    --cc=linux-raid@vger.kernel.org \
    --cc=mjt@tls.msk.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).