NetBSD-Users archive

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

Re: RAIDFRAME shrink

At Tue, 30 Mar 2010 14:32:10 +0400, "Rakhesh Sasidharan" 
<> wrote:
Subject: Re: RAIDFRAME shrink
> At work, with hardware RAID on an HP server, I recollect doing something
> like take out one of the disks in a mirror volume, replace with a larger
> disk, add that to the mirror, once mirroring is complete take out the
> other disk, replace with a larger disk, add to mirror, and thus end up
> with a RAID 1 volume that is larger that it was initially. Then the
> partitions on that volume were extended (this was a Windows server). I
> thought something similar might do the trick here.

Indeed if I understand correctly there's logically no reason why a
RAID-1 mirror cannot be extended and made larger.

In theory you could do this with RAIDframe and do so without damaging
any of the data (i.e. filesystems) currently within the mirror (assuming
if you're actually shrinking the volume that you've not got any data in
the part that will disappear), since if I'm not mistaken "raidctl -i"
does not actually touch any of the data area on a newly created RAID-1
mirror when one of the components is bad.

You'd simply destroy the RAIDframe configuration and create a new one
with the new size.

    1. "fail" the smaller disk and replace it with a new right-sized
    disk (assume raid0 is RAID-0 mirror of wd1a and wd2a, which are
    partitions matching the whole disk partition), something like this:

        raidctl -G raid0 > /root/raid0.conf
        raidctl -f /dev/wd2a raid0
        # disconnect old wd2, connect new wd2
        dd if=/dev/zero of=/dev/rwd2d count=1000

    2. reconfigure the size of the RAID-1 partition on the original
    larger disk by simply adjusting the label of that original disk,
    nuke the RAIDframe component label on wd1, then re-create the RAID
    with as a "broken" mirror after extending its partition to be the
    desired size, something like this:

        raidctl -u raid0
        dd if=/dev/zero of=/dev/rwd1a bs=1k skip=16 count=1
        disklabel -e wd1        # set size of 'a' to new size
        raidctl -v -C /root/raid0.conf
        raidctl -I 2010033099 raid0     # different from old serial#
        raidctl -i raid0

    3. label the replaced disk and add it as a spare and reconstruct the
    "new" mirror to it:

        disklabel wd1 > /root/wd1.label
        disklabel -R wd2 /root/wd1.label
        raidctl -a /dev/wd2a raid0
        raidctl -F 

However if you have data on the RAID volume then you'd be playing with
fire around it in a most dangerous way and you should be prepared to
restore from your backups!  :-)

It's easy enough to try it on a pair of spare partitions!  I'll leave
that as an exercise to the reader!

I think this simple resizing of a RAID-1 mirror could be added as a new
feature to RAIDframe with a new command line option to raidctl(8) so
that the dangerous bits of the operation above, including the reboot
reboot, can avoided.  Perhaps it could be as simple as a new option that
would re-read the disklabel and reset the size of a RAID-1 mirror from
that.  The operation then would be something like the following steps:

        raidctl -f /dev/wd1c    # fail the wrong-sized disk
        # swap out wd1 with a larger disk
        disklabel -e wd0        # fix label to use whole disk
        disklabel wd0 > /tmp/wd0.label
        disklabel -R wd1 /tmp/wd0.label
        raidctl -x raid0        # new option to re-read label
        raidctl -F /dev/wd1c    # reconstruct the mirror

Of course if you are shrinking the mirror this way instead of making it
larger then you would have to be sure the part that disappears does not
contain any data.

It could no doubt be simplified even further in some cases to avoid the
full reconstruct if it is only one component being grown or shrunk.

                                                Greg A. Woods
                                                Planix, Inc.

<>       +1 416 218 0099

Attachment: pgpR6oNWrP_LO.pgp
Description: PGP signature

Home | Main Index | Thread Index | Old Index