13
12
I am going to install a file server with Debian GNU/Linux 8.
I want to have software RAID-1 using mdadm as well as encrypted disks using LUKS. I also like the flexibility of having LVM.
There are different ways of doing this. One way is to: First set up RAID-1 using mdadm. Then set up LVM PVs to cover the /dev/mdX created. Then set up LVs and encrypt those using LUKS. Then format these with a filesystem, say ext4. This results in a layout like this:
RAID --> LVM --> LUKS --> ext4
Or I could to it in a different order:
RAID --> LUKS --> LVM --> ext4
Or maybe even:
LVM --> RAID --> LUKS --> ext4
And maybe even a different order altogether.
What are benefits and drawbacks for the different approaches? What gives best performance, security, maintainability, etc.?
Is there a "Best Way" of doing this?
Thanks for the quick reply. Good points! Can you comment on the performance differences if they are non-trivial? – Thomas – 2017-03-28T20:16:22.443
Updated with some performance notes. – Yan Li – 2017-03-29T05:30:46.877
1It should also be pointed out that you don't always need to use MDADM (although I expect this would be the most typical solution). - LVM offers RAID (aka mirroring) – davidgo – 2017-03-29T07:28:33.293
@davidgo Yes. I thought about mentioning that too but didn't do it, because I'm not sure if that's the right way to go. I haven't tried it personally (mostly I use higher levels of RAID like 5 or 6), and have read mixed feedback on LVM mirroring, such as mentioned by some answers in this question.
– Yan Li – 2017-03-29T16:33:08.253@Yan, I agree. I too always use mdadm RAid (1) – davidgo – 2017-03-29T18:22:48.190