[CentOS] Upgrade to new drives in raid, larger

Ross Walker rswwalker at gmail.com
Sat Dec 13 00:35:48 UTC 2008

On Dec 12, 2008, at 3:18 PM, "Bob Hoffman" <bob at bobhoffman.com> wrote:

> Hi all,
> As part of my raid experience, I have yet to have to do this, but was
> wondering how you guys would attempt it.
> I have 3 drives in a raid 1, with one as a hot spare.
> They are 250gb with all space used by two raid devices, 1 with boot,  
> the
> other with LVMs filling them up.
> Now, lets say down the road I want to put in 500gb drives and replace
> them....yikes.
> I was thinking of taking out the spare and replacing it first. Then  
> cloning
> the raid 1 array drive as I normally would. This would leave 250 gb  
> open.
> Then I was thinking to make it a spare and then pulling out drive 2  
> so drive
> 3, the 500gb, starts syncing.
> And replacing drive 2 as I did drive 3 above. When drive 3 is done  
> syncing
> then I can pull out drive 1 and allow drive 2 to sync while drive 1 is
> turned into a hot spare.
> Now, supposing this will work, can the raid device be enlarged  
> easily so the
> LVMs can be increased as needed (make the second raid fill up the  
> drive as
> it does now)?
> Or is there a  simpler or harder way to do this without waiting  
> forever for
> the syncing.
> I am thinking by the time I need to replace them, centos6 will be  
> out and I
> will just have to redo the whole computer anyway, but I have not  
> seen anyone
> talk about this, thought I would see what you gurus would do.

I did something similar on my rig recently moving raid1 from 160 to 320.

I only had the 2 drives, but here's what I did.

These drives had 2 partitions, boot and lvm, boot as md0 and lvm was  

1) Removed sdb1 from md0 and sdb2 from md1 making the two raids  
degraded. I shutdown and replaced the second disk with the larger one.

2) fdisk'd the new drive so boot partition was the same as first disk  
type autoraid, made it active too, and made a second partition out of  
the rest of the disk also type autoraid.

3) added the new boot partition to md0, ran grub and installed boot  
loader to new disk's MBR.

4) created a degraded raid1 called md2 out of new sdb2, use --force  
with mdadm

5) did a pvcreate out of md2 and added it to Volume Group 0, vg0 on my  

6) did a pvmove of md1 to md2 and removed md1 from vg0 when completed.

7) removed sda1 from md0 and sda2 from md1 killing md1 off, I don't  
remember if I did a mkinitrd at this point, but if in doubt, generate  

8) shutdown and replaced sda with sdb and put the second new drive as  
new sdb

9) fdisk'd boot partition of type autoraid and lvm partition of type  
autoraid, same as before. Added grub to new sdb mbr.

10) added sdb1 to md0 and sdb2 to md1, et voilà.

11) all you need to do now is resize any lvs and file systems that are  
tight on space.


More information about the CentOS mailing list