Rich Freeman via plug on 16 Dec 2021 15:11:21 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Growing a RAID 5 (sorry about the missend)


First, a disclaimer - I haven't used mdadm in ages, but I think this
is all still relevant.

On Thu, Dec 16, 2021 at 5:43 PM Adam Zion via plug
<plug@lists.phillylinux.org> wrote:
>
> I had a 1 TB RAID 5 consisting of 2 1TB drives (yes, that works).

Yup, and you can also just make it a raid1 and still add two drives
and convert to raid5, and I believe that can be done online.  I'd
check on that before trying it, but mdadm is remarkably flexible - one
of its biggest selling points IMO.

> I had expected that the second command would take a LONG time to complete. But, it seemed to finish in <1 min. Now, sudo mdadm --detail /dev/md0 yields the following:

As with most mdadm commands the userspace command just tells the
kernel to do something, and all the work happens in the kernel with
the command not blocking.  I'm not sure if it has an option to make it
block - I'm guessing not.

Also, as with most mdadm commands, the operation happens online and
will checkpoint if the system is shut down, so other than some IO
sluggishness it won't be immediately obvious that it is doing anything
at all.

>              State : clean, reshaping

The array is still reshaping.  I believe the easiest way to get a
progress report is:
cat /proc/mdstat

> Obviously, from the array size at the top, this has not completed adding the new drives to the RAID. But, at the bottom, mdadm clearly shows that it has done so.

The space won't change until the array has reshaped.  Basically the
stripes that have been reshaped work across all drives, and the
stripes that haven't just work across two, but all are updatable.

The main caveat with any sort of reshaping is that your stripes might
not align cleanly with sector boundaries/etc.  That really only
impacts writes to the very edges of a stripe, but it is a thing (I
think stripes support partial writes - if not then I guess it impacts
all writes).  I'm not sure if you can adjust for this when reshaping,
or maybe at this point mdadm does so automatically.

Again, I haven't touched mdadm in ages, so there is a risk that some
of this might be dated.

-- 
Rich
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug