jump to navigation

Creating a new Linux RAID1 device and extending an existing LVM Volume onto it. RHEL/Centos 5 13 June 2009

Posted by Maulvi Bakar in : Linux,System , trackback

I’m seriously into server consolidation and virtualization.  I’m going to eliminate my other VMWare server and just concentrate on one.

First order of the day is to upgrade the RAM and Available HDD space. Upgrading the RAM is simple enough, just add/replace the modules.

Expanding the available space is another matter.  This is actually an extension of my previous posting – New HDD, enlarging Red Hat/Centos ext3/lvm partition, but there’s another factor in the equation, RAID1 (Mirroring) devices.

The existing root partition resides in an LVM partition which in turn resides in a RAID1 (Mirroring) Multi-Disk (MD) partition which is based on a twin 400GB HDD configuration.

I’ve acquired a pair of 500GB HDDs. Now to extend the existing LVM ontothe newly acquired disks in a RAID1 configuration.

Step 1 is to create Software RAID partitions on the said disks –
# fdisk /dev/sdc
# fdisk /dev/sdd

Create a new ‘sdc1’ and ‘sdd1’ partitions using type FD, which is Linux RAID Autodetect.

Next, we need to create the Multi-Disk Volume –
# mdadm --create /dev/md2 --level=1 --raid-devices=2 /dev/sdc1 /dev/sdd1
Since I already have ‘md0’ for my ‘/boot’ and ‘md1’ is the existing volume with the existing LVM that was the intended target for expansion, thus naturally I’m using ‘md2’.

Basically, I am creating ‘md2’ device in RAID1 configuration using 2 devices namely ‘/dev/sdc1’ and ‘/dev/sdd1’.

You can monitor the status of your RAID devices using ‘/proc/mdstat’ –
# cat /proc/mdstat
Personalities : [raid1]
md2 : active raid1 sdd1[1] sdc1[0]
487331648 blocks [2/2] [UU]
[>....................] resync = 1.9% (9622656/487331648) finish=90.0min speed=88417K/sec

The steps here onwards are basically the same as previously mentioned here, the only difference is the ‘/dev/md2’ device is the target.

To start, we need to create a Physical Volume within the newly created ‘/dev/md2’ RAID device.
# pvcreate /dev/md2

After that we will extend the existing volume ‘VolGroup00? onto the newly created physical volume.
# vgextend VolGroup00 /dev/md2

Once done, the next step is to extend the Logical Volume within the volume group to use the free space newly made available when you extend the volume group previously.
# lvextend /dev/VolGroup00/LogVol00 /dev/md2
Here is the difference where I did not specify the space size to extend as the default will be to use all available spaces.

And finally, we’ll enlarge the ext3 partition to make use of the newly available free space in the logical volume.
# resize2fs /dev/VolGroup00/LogVol00

Enjoy!

Comments»

no comments yet - be the first?


Challenge *

π