0

I've been using an mdadm RAID1 array with 2 2TB disks for a few years without issues.

Recently I needed to upgrade it to 4TB so I bought 2 new disks of 4TB and plan to replace one, wait for the rebuild, then replace the other, grow, and to finish resize the filesystem in /dev/md0

The problem is that, in all these guides, the disks are partitioned before being added to the array (usually 1 single partition taking all disk), and I found that it's a common practise, but my disks were added to the array on its day without partitions, i.e.(one of my disks in the array):

Disk /dev/sdb: 1,8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x000059b8

So, the question is: is it really required to pre-partition a disk that will be used in a mdadm RAID1 array? is there any advantage on doing it?

1

Looking at tutorials such as this here, and in particular the discussion here, it would seem that the purpose of creating the single partition on drives used in a RAID is to

  • flag it as part of a RAID array by setting the type to 0xfd
  • prevent (rare) occurences of error message stating that "no partition table" was found on the disk
  • ensure drop-in replaceability (is this an english word?!) by setting the partition size to a well-defined quantity, typically slightly smaller than the disk size.

Point 3 seems to be the most valid one, because if you ever want to replace one hard drive with another, even of the same nominal size, the actual size will always vary by a small amount and true 'drop-in' replacement can only be achieved by creating a partition with a "well-defined" size [1].

Point 2 rather seems to be an annoyance than a show-stopper, and I personally have never encountered such an error message, but it can become an issue depending on your setting.

Point 1 in my experience is not necessary as mdadm will create a RAID UUID also on "whole-disk" devices which it can use to auto-detect that a disk is part of a RAID array.

So, all in all, it is not a strict requirement to partition the drives which will be used in a RAID array, but it can have advantages.

[1]: This kind of problem can break your neck also in situations when, e.g. you want to make a 1-to-1 verbatim copy of one hard-disk to another, when the partitions on your source drive span the entire disk size, and then your copying program finds out that the target drive, although nominally the same size, is a few hundred bytes smaller ...

  • Excellent answer, point 3 seems to be clearly the best advantage of it, thanks! – José Luis R.P. Nov 5 '19 at 15:51
  • It's "replaceability" :) – schaiba Nov 5 '19 at 15:54
  • You are correct, so I have corrected it ;) – AdminBee Nov 5 '19 at 16:07
  • In my experience. nowadays disk capacity for a given size e.g. "4TB" is exactly the same across different manufacturers. I expect there's been some standardization agreed upon although I can't quickly find any reference. – wurtel Nov 6 '19 at 8:56

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.