1

In each guide about software RAID in Linux, I could find online I see that people usually create/assemble RAID devices using partitions, like:

  mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1

I'm confused why everyone uses partitions and if there is any problem to use just physical volumes like:

mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sda /dev/sdb /dev/sdc

In this case I assume that if I have a failed disk I don't have to do any partitions on spare disk, just connect it physically and add to raid. For me it looks better.

So my question is: is there any side effect of using physical volumes to create Linux software RAID?

1

One of the advantages of using partitions in a raid is that it is clear that the disc is partitioned, and, if can you set the volume type of the partition (e.g. to fd (raid autodetect) using fdisk or the partition name using parted it is clear that a disc (partition) belongs in a raid array without having to look at the actual data in the first block of the device.

Also, if the discs are not all the same size, it is more easy to use the remaining disc space on the larger drivers. For small size diffrences that might not be useful, but I have a RAID with several 3TB drives and two 4TB drives. The 3TB drives have only partition taking the whole disc and I made the first partitions on the 4TB equal to those on the 3TB drive, with a second partition giving me access to the remaining 1TB¹.

¹ Of course mounting and accessing those partitions at the same time as using data on the RAID, can have a performance impact.

1

You do not need partitions if you really know what you are doing.

At the same time there is usually no downside to using partitions, so that's what most people do.

Side effects: You can not easily install a bootloader without partitions; and installers of various OS (even Linux-CDs) may think an unpartitioned disk to be empty and overwrite it, so you have a higher risk of inadvertently corrupting your RAID.

Personally, I like partitions. I even use more of them than strictly necessary. I slice my disks into smaller units (e.g. 250G instead of 4T), creating several smaller RAIDs with them (later merged by LVM). I find them easier to handle and maintain than very big arrays.

0

You are actually using devices in the second command. In the first one take into account that a partition can be of type LVM and a physical volume too, so maybe what you think is "just a partition" is also a physical volume.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.