Mixed raid types

mdadmpartitionraidsoftware-raid

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?

Best Answer

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.

Related Question