I want to setup a debian server mainly used as data storage. I have 4 devices:

  • /dev/sda (160GB) - installed debian on it
  • /dev/sdb, /dev/sdc, /dev/sdd (all 500GB) - created a raid5 array with it

Now I am not sure, how to go on. Is it usefull to create a LVM on the raid5 /dev/md0? How can I do this? Is there a good HowTo?

Or can I just create filesystem on the raid5 and create different partitions?


Create the mdadm raid5 array. Create a volume group (I used the complete array). Create LVM2 logical volumes at whatever size you deem necessary.

I used redhat's documentation when building my 8TB NAS on Debian Lenny.


  • The LVM2 logical volumes are my partitions then? Or do I need to partitioning them respectively installing a filesystem on them? – Georg Leber Feb 8 '11 at 19:48
  • Most likely what you want is for LVM to be directly on top of the /dev/md* device. So use pvcreate on /dev/md* and pass /dev/md* to vgcreate. Within the volume group you create your LVs, and on your LVs, you put a filesystem. – Zoredache Feb 8 '11 at 19:57
  • @Zoredache: I was to fast ;) Everything was written in redhat's documentation posted by PG Puters. But thanks for your response. – Georg Leber Feb 8 '11 at 20:02

If you are running a server, what will happen if your root device (on /sda) goes down?

It is normal to have at least a RAID1 configuration for your root partition, to help keep the server up should a single disk fail. If uptime isn't an issue perhaps this isn't a consideration. Note that you have to be careful to get grub installed on both disks' boot sectors if you are using software raid for a boot partition.

Raid 5 for your data storage is sensible, although Raid 6 is better! You asked

Is it usefull to create a LVM on the raid5 /dev/md0?

If you want to use up the whole of the software raid device, it isn't useful to create LVM logical devices. If you think you might want to, for instance, move /var off your boot device to a new device created in a logical volume, then yes. Naturally if you are going to do that you should be careful not to use the whole of your md0 device with a single logical volume as then the reason for using lvm is somewhat obviated.

Other important stuff to know about lvm:

  • While it is fine to fill up your PV with a VG, don't fill up your VG with LVs if you want flexibility in future (!)
  • Choose a filesystem that can expand if you choose to extend an LV (XFS is a good choice)
  • Filesystems in general aren't good at contracting to match an LV contraction
  • LVM snapshots are best avoided as they have terrible IO.

Check out the tldp Howto for some more interesting info.

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.