From: David Brown <david.brown@hesbynett.no>
To: Scott D'Vileskis <sdvileskis@gmail.com>, linux-raid@vger.kernel.org
Subject: Re: Replace RAID devices without resorting to degraded mode?
Date: Wed, 12 Mar 2014 10:12:35 +0100 [thread overview]
Message-ID: <53202503.10901@hesbynett.no> (raw)
In-Reply-To: <CAK_KU4ZfsCOyZxgkxLC7AFOJ2XEvcHi-Gr7itv4q_pPOQbaAYA@mail.gmail.com>
On 11/03/14 18:36, Scott D'Vileskis wrote:
> Hello--
> I have been using Linux RAID for about the last 12 years or so and
> have endured dozens of RAID migrations, swapping of disks, growing &
> shrinking arrays, transforming partitions, etc. I consider myself
> pretty well versed in RAID0/1/5, and more recently RAID6.
>
> I would like to grow my RAID5 array to fill larger devices (larger
> partitions, actually). In the past, the typical method of replacing
> all the disks/partitions with larger ones is to:
> 1) Add a larger drive/partition as a hot spare
> 2) Fail a disk
> 3) Wait for the rebuild/resync
> 4) Repeat for each disk in the array
> 5) After all drives/partitions replaced and resynced, Grow the device
> and wait for a resync of the new space.
> 6) Resize the filesystem
> While this typically works flawlessly, it does require the array to be
> operated in degraded mode for the entire operation, which many would
> consider risky.
>
> Does Linux MD RAID support a method of hot replacing a disk WITHOUT
> having to resort to degraded mode?
Step 1 in all this is, of course, to take a backup. And step 2 is to
check that your backup is good.
It is also a good idea to practice on fake arrays made from loopback
"disks" - they work fine for md raid, and let you practice re-shaping,
re-sizing, etc., without any risk to your real disks.
If you want to safely replace the disks in a raid5 array, the easiest
way is to add a new disk (this can be an external USB disk if necessary)
and re-shape to an asymmetric raid6 with parity Q on the new disk. Now
you have an extra redundancy for safety. (Use asymmetric raid6 to avoid
re-striping the existing disks.)
In your case, I think you want to re-use the original disks (but with
different partitioning). So for each disk, you have the steps:
1. Fail the disk.
2. Re-partition the disk. It's a good idea to zero the superblock too,
to avoid confusion.
3. Add the new disk partition into the array as a hot spare.
4. Wait for the rebuild/resync
And at the end, fail the extra disk with the Q parity, then reshape back
to raid 5 (this will not involve any data movement since the disks are
already in raid 5 shape). At all times, you have at least 1 disk worth
of redundancy.
If you are using new disks (or at least one more new disk), and you have
a new kernel and mdadm with hot replace support, then the procedure is
similar. First make your asymmetric raid6 with an additional disk for
extra safety. Then for each disk in the main array, do this:
1. Attach a new disk, and partition it appropriately. Zero the
superblock if it is a recycled disk. Then add it as a hot spare.
2. Mark one of the original disks as replaceable.
3. Wait for the rebuild as data is copied from the replaceable disk to
the hot spare.
4. Fail and remove the replaced disk.
Again, remove the extra Q parity disk at the end. After the generation
of the Q disk and before its removal, you have at least 2 disks of
redundancy. This gives you extra protection against user error, such as
pulling the wrong disk!
next prev parent reply other threads:[~2014-03-12 9:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-11 17:36 Replace RAID devices without resorting to degraded mode? Scott D'Vileskis
2014-03-11 23:26 ` Adam Goryachev
2014-03-12 0:00 ` Scott D'Vileskis
2014-03-12 11:54 ` Mikael Abrahamsson
2014-03-12 9:12 ` David Brown [this message]
2014-03-12 12:23 ` Raul Dias
2014-03-12 12:45 ` David Brown
2014-03-12 23:18 ` NeilBrown
2014-03-13 9:27 ` David Brown
2014-03-12 15:38 ` Scott D'Vileskis
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=53202503.10901@hesbynett.no \
--to=david.brown@hesbynett.no \
--cc=linux-raid@vger.kernel.org \
--cc=sdvileskis@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.