mkfs on raw software raid device or partition

I am making a huge RAID10 device (8 TB) for storage on CentOS. I have created the 4 partitions on my 4 physical hard disks and have created the raid device /dev/md2 out of those 4 partitions.

Now it's time to put a filesystem on it. I am wondering whether I should do just:

mkfs.ext4 /dev/md2

which totally works (I tried it), or I should first create a single partition on that device (with fdisk, gdisk or parted?), that takes up all the space, and then do the mkfs stuff on that partition.

Googling the Web, I found another person asking the very same question here: http://ubuntuforums.org/showthread.php?t=2174067 but, although a responder said:

Partitions go on the array members.
Filesystem goes on the array.

they didn't give him a definitive, non-ambiguous answer or an explanation when one approach should be preferred over the other.


The only method I have ever used was to partition the physical disks, then combine the partitions into a RAID, and put file system (or swap) directly on the md device.

As far as I know partitioning the md device is a feature, which was added later, but never became widely used.

I would recommend against attempting to create a RAID directly on a physical device without partitioning that device first. Lot of software expects hard disks to be partitioned, and the partition table contains a type field for each partition, which will tell software reading the partition table that this partition is part of a RAID.

Whether to use a partition table on top of the md device may be a matter of taste. It might be entirely due to historical reasons, that it is usually not done. The tiny amount of additional disk space consumed by the extra layer of partition table is certainly not a reason to avoid it, and just as at the lower layer, the partition table on top of the md device would indicate what to expect to find inside.

However the flexibility gained by being able to partition the md device, I consider to be negligible, because you can create multiple partitions on the physical device instead and create multiple md devices.

Multiple md devices which are not partitioned give you more flexibility than one md device which is partitioned. You have additional freedom when time comes to replace one of the underlying media, and you can configure the different md devices with different RAID levels.

For example if you have six disks, you could make /boot be RAID-1 with a copy on every disk. / could be a RAID-1 with copies on three disks and a RAID-1 with copies on the other three disks could be used for swap. Remaining space could be a large RAID-6 across all six disks.