RAID on partitions or devices

2

1

I plan to create a software-only Linux MD RAID10 array from two identical 1TB discs (using mdadm). Should I create it directly on the two disc devices (/dev/sda and /dev/sdb) or create a partition in each of the drives to use for the array (/dev/sda1 and /dev/sdb1)?

The reason I am asking is because I have heard that the partition approach can be a good idea, making the partitions slightly smaller than the entire device so as to accommodate future replacement discs of slightly smaller size. However, some sources (man mdadm) suggest that this is more correctly achieved using the --size option for mdadm, but I cannot figure out if this will work for RAID10?

Thomas Arildsen

Posted 2013-07-29T11:33:10.900

Reputation: 727

1>

  • RAID 10 requires four volumes (either four disks, or if you are utterly insane 4 partitions on spinning disks). 2) I would go for the volumes (/dev/sda1 etc) to allow for smaller replacement disks and to avoid potential problems with RAID and GEOM meta data.
  • < – Hennes – 2013-07-29T12:31:11.183

    1

    To clarify the differences between RAID 0 (stripe), RAID 1 (mirror) and RAID 10 ( a stripe of mirrors ) and RAID01 ( a mirror of stripes ) please see this post on our sister site SF.

    – Hennes – 2013-07-29T12:40:43.157

    @Hennes As far as I can see, "Linux MD RAID10" (which I have in mind) requires at least two volumes: http://en.wikipedia.org/wiki/Non-standard_RAID_levels#Linux_MD_RAID_10. Am I missing something?

    – Thomas Arildsen – 2013-07-29T13:02:19.603

    @Hennes BTW, thanks for the post on SF. Nice to know that RAID01 should be avoided. And, reading about the capabilities of ZFS has got me very interested now... – Thomas Arildsen – 2013-07-29T13:07:30.123

    A stripe of multiple volumes on a single disk makes no sense. It might work, but the goal of a stripe is to increase performance by combining the speed of multiple drives. A stripe of two volumes on the same drive would effectively yield "twice * half the speed". And that ignores extra overhead and unneeded complexity. As to ZFS, it is very powerful. Just make sure you read all the documentation and that you realise the CPU and RAM needed for some of the advanced features. (E.g. dudeplication). Having said that, Sun made a great system with ZFS. – Hennes – 2013-07-29T14:05:48.610

    @Hennes As far as I understand, MD RAID10 should be able to give me both the redundancy of RAID1 and the performance of RAID0 combined, even with two discs, right? – Thomas Arildsen – 2013-07-29T15:30:11.057

    No. You get the redundancy and read-performance boost of RAID 1, but not the performance increase of RAID 0.

    Compare it to this analogy. If you have one secretary working at top speed, and you give her two jobs. Does more work get done? (Answer: no, She might be working on two jobs, but each goes half as fast.) – Hennes – 2013-07-29T15:36:20.520

    let us continue this discussion in chat

    – Thomas Arildsen – 2013-07-30T07:59:58.593

    Answers

    1

    I ended up choosing the partition-based solution. After all, this should allow me to mount one of the mirror member partitions as a regular partition if the RAID metadata is somehow lost, as I experienced recently: https://askubuntu.com/questions/311024/raid1-array-lost-after-upgrade-from-ubuntu-11-10-to-13-04. I was not sure whether I would be able to recover like this if I were to create the array directly on the devices using mdadm --size ... solution.

    Thomas Arildsen

    Posted 2013-07-29T11:33:10.900

    Reputation: 727

    1

    I don't think your partition vs drive question relates to your array being a MD RAID 10. The partition vs drive question is preferential. And when it comes to growing or shrinking arrays, if MDADM can do something for RAID 1, it can probably do it for raid 10.

    On that note, it is easier if you do not use the whole drive for your array just in case another drive you get in the future ends up being smaller, and whether or not you address such an issue now or later is a matter of preference. I personally use a partition that is slightly smaller for my MD RAID 10 array because it is safer than messing with sizes after the array is in place.

    And in contrast to what Hennes has said, you DO get a performance boost when you use a software RAID 10 on two drives. My performance literally doubled the moment I rebuilt my array into 10 from 1 using the same drives in the same computer. Seems ridiculous RAID 1 doesn't naturally read from both discs, but it doesn't! I am thinking about adding a third drive for double redundancy since I am using older drives and I think I run a high risk of failure during a rebuild due to using older hardware in general. And the speed boost doesn't hurt.

    As a note, I even have two different size drives (1TB and 2TB),from 2 different manufacturers. Not the best scenario, but it works great! Writes are slower than a single drive, but reads are fast! Only 2 drives and rebuilds are quick! (no parity) Enjoy your two drive RAID 10 and just enjoy all those people like Hennes who are SURE you need 4 drives. :)

    Damon

    Posted 2013-07-29T11:33:10.900

    Reputation: 1 789

    Well, I actually ended up going for RAID1 for the simplicity of being able to mount a single member partition, should I somehow mess up the RAID metadata. I guess that will not be possible with RAID10? – Thomas Arildsen – 2013-07-31T21:16:36.487

    Now that you have confirmed the speed advantage, I am tempted to go for RAID10. I haven't actually repopulated the array yet, so I can easily do it over again. – Thomas Arildsen – 2013-07-31T21:18:12.053

    Simplicity is usually better. RAID 1 is simple and therefore it works great. MD RAID 1 vs MD RAID 10 is was no brainer in my mind after I did it. Before, it seemed kinda weird and complex, but when you go through the motions its really simple. Don't know why all hardware controllers don't do the same thing. – Damon – 2013-08-01T01:31:34.437