[CentOS] Questions about software RAID, LVM.

SilverTip257
Tue, 05 Feb 2013 01:07:43 -0000

On Mon, Feb 4, 2013 at 6:40 PM, Robert Heller <heller at deepsoft.com>
wrote:

> I am planning to increase the disk space on my desktop system.  It is
> running CentOS 5.9 w/XEN.  I have two 160Gig 2.5" laptop (2.5")
SATA drives
> in two slots of a 4-slot hot swap bay configured like this:
>
>
I would certainly suggest testing these steps out in some form or another
as a dry run.  And verify your backups and/or create new ones ahead of
time. :)

Create your new softraid mirror with the larger disks, add that device
(we'll say md3 - since the new /boot will be md2 temporarily) to your
existing LVM volume group, then pvmove the physical extents from the
existing disk /dev/md1 to /dev/md3.  Then verify that the extents have been
moved off md1 and are on md3.  Finally remove md1 from the VG with pvremove.

I don't recall if I specifically used these notes, but the process matches
the one I used. [0]
A few more bits of info I recognize from my readings a while back. [1] [2]
[3]

I expect you could easily tweak your mdadm config and rebuild your initial
ramdisk so that the next time you reboot there isn't an issue.  This all
depends on how much of this process you plan on doing online.

[0]
http://www.rhcedan.com/2010/10/20/migrating-physical-volumes-in-a-lvm2-volume-group/
[1]
http://www.centos.org/docs/5/html/Cluster_Logical_Volume_Manager/move_new_ex4.html
[2] http://tldp.org/HOWTO/LVM-HOWTO/removeadisk.html
[3]
http://www.whmcr.com/2011/06/21/moving-part-of-an-lvm-vg-from-one-pv-to-another/

sauron.deepsoft.com% cat /proc/mdstat
> Personalities : [raid1]
> md0 : active raid1 sdb1[1] sda1[0]
>       1003904 blocks [2/2] [UU]
>
> md1 : active raid1 sdb2[1] sda2[0]
>       155284224 blocks [2/2] [UU]
>
> unused devices: <none>
>
> That is I have two RAID1 arrays: a small (1Gig) one mounted as /boot
> and a larger 148Gig one that is a LVM Volume Group (which contains a
> pile of file systems, some for DOM0 and some that are for other VMs).
> What I plan on doing is getting a pair of 320Gig 2.5" (laptop) SATA
> disks and fail over the existing disks to this new pair.  I believe I
> can then 'grow' the second RAID array to be like ~300Gig.  My
question
> is: what happens to the LVM Volume Group?  Will it grow when the RAID
>

In my experience the VG will grow by whatever extents the new PV has.
I found it quite helpful to use loopback devices to test possible softraid
and/or LVM scenarios.


> array grows?  Or should I leave /dev/md1 its current size and create a
> new RAID array and add this as a second PV and grow the Volume Group
>

Just add md3 to the VG and move the extents as noted above.


> that way?  The documentation is not clear as to what happens -- the VG
> is marked 'resisable'.
>

The biggest gotcha is with PVs.
Example even though this doesn't apply:
In that if you plan on enlarging a disk (ex: LVM backing for a VM that uses
LVM), the PV in the VM has to be offline to resize (the OS doesn't
recognize the larger disk until after a reboot, but cannot be resized since
the PV is online again!).  You avoid that pitfall since you will have a
separate disk (md3) that can be hot added.


>
> sauron.deepsoft.com% sudo pvdisplay
>   --- Physical volume ---
>   PV Name               /dev/md1
>   VG Name               sauron
>   PV Size               148.09 GB / not usable 768.00 KB
>   Allocatable           yes
>   PE Size (KByte)       4096
>   Total PE              37911
>   Free PE               204
>   Allocated PE          37707
>   PV UUID               ttB15B-3eWx-4ioj-TUvm-lAPM-z9rD-Prumee
>
> sauron.deepsoft.com% sudo vgdisplay
>   --- Volume group ---
>   VG Name               sauron
>   System ID
>   Format                lvm2
>   Metadata Areas        1
>   Metadata Sequence No  65
>   VG Access             read/write
>   VG Status             resizable
>   MAX LV                0
>   Cur LV                17
>   Open LV               12
>   Max PV                0
>   Cur PV                1
>   Act PV                1
>   VG Size               148.09 GB
>   PE Size               4.00 MB
>   Total PE              37911
>   Alloc PE / Size       37707 / 147.29 GB
>   Free  PE / Size       204 / 816.00 MB
>   VG UUID               qG8gCf-3vou-7dp2-Ar0B-p8jz-eXZF-3vOONr
>
>
>
> --
> Robert Heller             -- 978-544-6933 / heller at deepsoft.com
> Deepwoods Software        -- http://www.deepsoft.com/
> ()  ascii ribbon campaign -- against html e-mail
> /\  www.asciiribbon.org   -- against proprietary attachments
>
>
>
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
>


Hope this helps.

Best Regards,
--
---~~.~~---
Mike
//  SilverTip257  //