I am about to reinitialise my (SW) raid array.

Previously the array was raid5 with 4 disks. I've removed one disk in order to install a new additional (larger) drive.

What I'd ideally like to do is mix types of raid across the 3 disks. Having 1 section of 3 way mirrored raid1, a section of raid5 and a section of raid0 offering various levels of protection for my more and less important files, while wasting as little space as possible.

I can do this by creating 3 separate raid partitions on each disk and assembling 3 arrays from this, but this has a number of downsides:

  1. The size of each section would be fixed from the outset and changing this would be rather tricky
  2. I would be limiting my directory layout options and probably end up resorting to symlinks to retain a logical layout

What I would really like is a single filesystem, where I can set a property on individual files/directories, indicating the level of protection required for those files, resulting in the file being mirrored as appropriate.

Is there any way to achieve this on SUSE, perhaps with an esoteric filesystem format?


One possible solution is to use LVM to manage redundancy, instead of using the mdadm Linux software RAID.

Simply initialize all three disks as LVM physical volumes, assign them to the same volume group and use the correct flags when setting up logical volumes.

-m, --mirrors Mirrors Creates a mirrored logical volume with Mirrors copies. For example, specifying -m1 would result in a mirror with two-sides; that is, a linear volume plus one copy.

So for example the commandline lvcreate -m1 -L 10G -n <name> <volume_group> would create a mirrored logical volume or the equivalent of a RAID1 array.

-i, --stripes Stripes Gives the number of stripes. This is equal to the number of physical volumes to scatter the logical volume. When creating a RAID 4/5/6 logical volume, the extra devices which are necessary for parity are internally accounted for. Specifying -i3 would use 3 devices for striped logical volumes, 4 devices for RAID 4/5, and 5 devices for RAID 6.

Since you have three disks 2 would be the maximum number of stripes (the third is for parity) and lvcreate --type raid5 -i2 -L 20G -n <name> <volume_group> would set up the equivalent of three disk RAID5 array.

  • This looks rather handy. Presumably, this being LVM, I would be free to resize the filesystems as and when required? It doesn't solve the 2nd part of course but it's a good start!
    – DJL
    Jul 2 '14 at 10:16
  • Yes using LVM gives you the freedom to resize and change layouts in the future, although it depends a bit on the filesystems you select, some don't shrink too well... /home/djl can be on a mirrored volume for speed and reliability, /bigdata can be on a different LVM without any additional redundancy.
    – HBruijn
    Jul 2 '14 at 10:21

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.