Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have seen a few descriptions about using mdadm with lvm to create an easily expandable raid, such as this question, but I still think I'm missing something. Say that I create the raid using mdadm with 4 drives using raid5, then make an lvm volume(?) on top of that, then format that lvm volume with ext3. That all sounds good.

Then I want to add some more space, so I put another hard drive in. How do I add it? If I just add it to the lvm, then it is not part of the raid5 set. If I add it using "mdadm --grow", then after that is done, I still have to unmount and resize the ext3 filesystem.

I thought if I used lvm on top of mdadm it would be unnecessary to unmount and wait for the resize (which takes forever with a 5tb raid). Is that correct?

I have done this before without using lvm, using just "mdadm --grow", then I think resize2fs. But that took days, during which the drive had to be unmounted.

Thanks!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

ext3 supports online resizing, which means that you can grow the filesystem while it is mounted. The procedure would be:

  1. Add the new drive
  2. mdadm --grow to add it to the RAID
  3. pvresize to increase the size of the PV
  4. lvextend to increase the size of the LV
  5. resize2fs to grow the filesystem
share|improve this answer
    
Thanks for the answer, so my next question would be; what's the point in me using lvm then, if ext3 supports online resizing by itself? –  localhost May 1 '12 at 6:59
1  
LVM gives you flexibility regarding how you organise the storage. It allows you to use multiple PVs in a single LV (e.g. you add another RAID set), and have multiple LVs per PV (e.g. you want more than one filesystem). It's usually a good idea to setup LVM even if you only have one PV and one LV initially. –  mgorven May 1 '12 at 17:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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