-   Linux - Server (
-   -   Using mdadm with different capacity drives in RAID 5? (

lolhan 08-10-2009 03:42 PM

Using mdadm with different capacity drives in RAID 5?
Hi all,

I am going to soon setup a RAID 5 configuration for a server with mdadm.

However, I am hoping to use the following configuration:
4x1TB SATA 3Gb/s HDD
2x500GB SATA 3Gb/s HDD

in a RAID 5 configuration. If this works as I imagine it, I should be left with about 3.5TB of total space.

I am thinking it might be possible to create a striped array with the 2 500GB drives so the system sees 5x1TB HDDs.

The reason I want to do this is simple, to achieve the highest capacity while remaining some failure redundancy. I bought the 1TB drives to use in this configuration specifically and the 500GB drives would essentially be unused by me any longer, sitting in the closet or under-appreciated in a workstation somewhere.

Impossible? Please lend me your assistance!

Pearlseattle 08-22-2009 09:31 AM

It should be quite easy :D

Let's say you have the following HDDs:
sda1: 500GB
sdb1: 500GB

sdc1: 1TB
sdd1: 1TB
sde1: 1TB
sdf1: 1TB

You first create a raid0 using your two 500GB drives:
mdadm --create --verbose /dev/md0 --level=0 --raid-devices=2 /dev/sda1 /dev/sdb1

Then you create the raid5 using the four 1TB drives, plus your 1TB raid0:
mdadm --create /dev/md1 --level=5 --raid-devices=5 /dev/md0 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1

This should give you 4TB capacity.
Is this what you would like to do?

Ah - and to assemble it after a reboot you start of course first the raid0 with...
mdadm --assemble /dev/md0 /dev/sda1 /dev/sdb1
...and then the raid5 with...
mdadm --assemble /dev/md1 /dev/md0 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1

MrAngel 10-27-2009 08:18 AM

An alternative solution - which may make things easier if you come to add more drives to the array at a later date - is to split the 1TB disks into 2 partitions, which would give you 10 partitions of 500GB each. Create a raid5 array with 6 members (/dev/sd*1) and another with 4 members (/dev/sd*2). As long as no array contains more than one partition from the same disk, you still have your redundancy.

This seems to be the most common way of using raid5 on disks of different sizes.

All times are GMT -5. The time now is 02:41 AM.