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.



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
  • 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

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.