3

I want to add another disk as RAID 1 to test my database performance. I am trying to not re-do the whole system, is it possible?

Currently I have a single 1TB HDD with one 100GB system partition (and swap, boot) and a 850GB /home partition. I want to if possible, add another 1TB drive and convert the whole system to RAID 1, or atleast raid the /home partition (and discard the other 150GB on the second disk).

Is it possible? atleast in software RAID (on CentOS 6.4)

1
3

If you're using LVM for the primary partition you can always add another disk to the pool and then extend into it. Given you're using CentOS I would assume that the system was setup so that you have an LVM partition providing your storage and then their are logical volumes coming from LVM for /home and /.

Example

Here on this CentOS 6.x system I have the following physical volumes being included into LVM.

$ sudo -i

$ pvs
  PV         VG         Fmt  Attr PSize   PFree
  /dev/sda2  VolGroup00 lvm2 a--  465.66G    0 

The HDD /dev/sda2 is part of a single volume group:

$ vgs
  VG         #PV #LV #SN Attr   VSize   VFree
  VolGroup00   1   3   0 wz--n- 465.66G    0 

The logical volumes are as follows:

$ lvs
  LV       VG         Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  LogVol00 VolGroup00 -wi-ao 442.19G                                      
  LogVol01 VolGroup00 -wi-ao  13.69G                                      
  LogVol02 VolGroup00 -wi-a-   9.78G                  

These logical volumes get mounted like so:

$ mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)

So you could add another disk to the volume group and then make use of it in which ever logical volume needs the space.

Diagram

                              ss of LVM

The above, hopefully, illustrates how LVM architecturally works. Often times, people will create LVM volume groups which sit on top of RAID arrays. This gives you the ability to expand a filesystem using LVM but with the protection offered through the use of a RAID array for redundancy purposes.

So you could add another physical volume to the VG (volume group). This new physical volume would then show up as new space which could then be allocated to one of the LG's (logical volumes).

Migrating to RAID

  1. I would suggest setting up the RAID along side your existing HDD. You can setup a RAID array as RAID1 (then degrade it by only adding 1 HDD to it.)

  2. Once the RAID array is setup, I'd put LVM on top of it as discussed above, and then migrate the data from the existing HDD to the LVM topped RAID1 array.

  3. Once the data has been migrated in, you can then bring the original disk into the RAID1 array and resync it.

For the nitty gritty details I often refer to this HowtoForge article, titled: How To Set Up Software RAID1 On A Running LVM System (Incl. GRUB2 Configuration) (Ubuntu 10.04). Don't let the reference to Ubuntu scare you away, most of the steps are identical and I find the level of details in this particular article crucial to understanding what you're actually doing for the various steps when migrating to a LVM + RAID1 setup.

References

6
  • yes. they are logical. is there any guides to doing that? Sorry I have never done it. And that wouldn't work for the whole drive right?
    – xcorat
    Dec 10 '13 at 17:07
  • This looks reasonably carefully written: community.spiceworks.com/how_to/show/… Dec 10 '13 at 17:10
  • @xcorat - The use of LVM + RAID is powerful but requires you master 3 technologies, so often it scares ppl away. You need to understand LVM, mdadm (RAID) and disk partitioning w/in Linux. I would spend the time with another drive experimenting prior to doing this work if you've never done it before.
    – slm
    Dec 10 '13 at 17:17
  • @xcorat - The LVM you can add more disks but it's more inline with a RAID0 (it's not RAID at all - but your data is now spread across 2+ disks, so it's more risky).
    – slm
    Dec 10 '13 at 17:18
  • Thank you for the great answer. But we thought it's better to raid the whole drive anyway and did it from scratch. I'm sure this will be useful at some point anyway.
    – xcorat
    Dec 10 '13 at 21:43
0

If you are not using LVM you can still create a broken mirror with the existing block device, then add the second block device to it. It is not trivial and you are putting your DB data at risk. Also - you will have to wait for the second block device to finish sync or you will be testing IO during a rebuild.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.