From: Michael Tokarev <mjt@tls.msk.ru>
To: wayne@flashmedia.co.za
Cc: linux-raid@vger.kernel.org
Subject: Re: Online resize
Date: Wed, 12 Mar 2008 12:38:25 +0300 [thread overview]
Message-ID: <47D7A491.9020205@msgid.tls.msk.ru> (raw)
In-Reply-To: <200803121114.27080.wayne@flashmedia.co.za>
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.
>> b) restore partitions to the EXACT size as they were before, and
>> start from scratch
> Thats easy enough. I'll do that now.
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
next prev parent reply other threads:[~2008-03-12 9:38 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 [this message]
2008-03-12 11:17 ` Wayne Gemmell
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=47D7A491.9020205@msgid.tls.msk.ru \
--to=mjt@tls.msk.ru \
--cc=linux-raid@vger.kernel.org \
--cc=wayne@flashmedia.co.za \
/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).