[CentOS] Installing on partitionable RAID arrays

Thu Mar 26 13:47:26 UTC 2009
RedShift <redshift at pandora.be>

Raja Subramanian wrote:
> On Thu, Mar 26, 2009 at 5:42 PM, RedShift <redshift at pandora.be> wrote:
>> Since linux 2.6, the md layer has a feature called partitionable arrays. So instead of having two disks, creating an identical partition table on both and then putting those partitions in RAID 1, you take those two disks and put them in one partitionable RAID 1 array (in mdadm terms, "mdp") and create a partition table on the new RAID device. The advantages are quite clear compared to the old non-partitionable arrays.
> 
> For the uninitiated, would you be kind enough to elaborate the
> advantages of mdp?
> 
> I have always created identical partitions on the raw disks first,
> and the used mdadm on top.  I also create my partitions ~200MB
> smaller than raw disk capacity to ensure minor size differences
> between disks (eg. 160GB HDD from Seagate is not exactly same
> size as a 160GB disk from Samsung) will not prevent me from
> adding them to a raid set.
> 
> Does mdp handle this scenario?
> 

When you run a partitionable array you don't have to care about the partition table on the independent disks. So when a disk fails, you don't have to recreate the exact same partition table, you just swap the device using the mdadm tool.

Another advantage is that you don't have to do the disk swap for every partition. For example, in the old scenario, you have two disks (sda and sdb) with 4 partitions on them each. On those 4 partitions you create your RAID arrays, like md0=sda1,sdb1; md1=sda2,sdb2; and so forth. When sda fails, you have to remove the failed disk from all of the 4 RAID arrays and when you've put in the new disk, you have to signal all 4 arrays that the new disk is to be used. Not only do you have to execute 4 times as much commands, reconstruction of the 4 arrays will take place in parallel leading to slow disk access during reconstruction. When reconstructing a partitionable array using whole disks, reconstruction will always be sequential.

In the disks not being equal scenario: you can limit the size of the RAID array during creation with the -z parameter (man mdadm, chapter "For create, build, or grow:"). So instead of limiting the size of the partitions you create, you limit the whole size of the RAID array. So having a smaller replacement disk is no problem as long as it's equal or bigger than the array size you defined during creation.


Best regards,


Glenn Matthys