Growing LVM on RAID5

I feel to write this blog due to my requirement .
Day to day requirement of data storage capacity growing .
let assume i made 3 disk software RAID on my Centos6 box having 2Gb disk each( production may have huge size in TB sure) with LVM configured.

Let say i have disks

/dev/sda  -2GB
/dev/sdb  -2GB
/dev/sdc  -2GB

I made a RAID5 named /dev/md0    ( see my other blog for how to create software RAID)

I also made lvm with /dev/md0    /dev/mapper/raidvg-mylv   of 5 GB

No i need to extend the size of my logical volume from 5 to 7 hence i need one 2 GB disk in my Raid.

So the steps are as bellow:-

# mdadm --manage /dev/md0 --add /dev/sdd

mdadm:added /dev/sdd

See the detail now for status of disk

# mdadm --detail /dev/md0
You will see a line for newly added disk

       0       8       16        0      active sync   /dev/sda
       1       8       32        1      active sync   /dev/sdb
       2       8       48        2      active sync   /dev/sdc
      

       3       8       64        -      spare   /dev/sdd
You new disk is in spare mode

now grow your RAID
# mdadm --grow --raid-devices=4 /dev/md0

And you can see the status of RAID rebuilding
# watch cat /proc/mdstat

When building and reshaping  get completed mdadm --detail /dev/md0 command will show raid with new disk as in sync and active . Done for RAID growing!

Now we will see the lvm part-

Your pvdisplay command is showing you the old md0 capacity hence you need to update this

# pvresize /dev/md0
pv capacity will be altered as per /dev/md0 new size hence vg size will automatically grow. now you have free space available to lvextend 

# lvextend -L 5g /dev/mapper/raidvg-mylv

And all set !






Comments

Popular posts from this blog

Running web ssh client on port 443 /80 with nginx as reverse proxy

Running cockpit behind nginx reverse proxy with nginx ssl and cockpit non ssl

How to create bulk user from csv in openldap server