5

I'm curious how the concept of partitions (and partition tables) co-exist with the concept of RAID arrays. Here is my current understanding (correct me if I'm wrong anywhere):

A physical hard-drive disk can be partitioned into several segments. A partition table lives at the beginning of the disk space to describe how it is partitioned. There are several partition table types (MBR, GPT, ...)

A RAID array is a single "physical volume" that is comprised of multiple hard-drive disks (i.e. an array). To the OS this appears as a single physical device. Furthermore, this RAID array can be partitioned as a whole.

So my question - if you add physical disks to a RAID controller will that RAID controller automatically hijack each physical disk and blow away/rewrite a single disk partition table such that it controls the entire device? Or are RAID controllers conscious of the fact that individual drives may be partitioned?

Izzo
  • 185
  • 7

4 Answers4

6

Typically a hardware RAID controller is unaware of any partitioning on the disk - it assumes that if you add a disk to the array, it owns that disk in its entirety and writes its own (possibly proprietary) control structures on it where it wants to. It does not necessarily add a disk that's inserted, into an array - you could have multiple arrays defined on one hardware controller, for instance, and would have to manually select which array the new disk goes into - so you can have standalone single disks on many hardware RAID controllers. (I guess you could think of them as single-drive RAID0 arrays.) Because the hardware RAID controller sits between the physical drive hardware and the lowest level of the OS, it will be unaware of what partitioning scheme the OS chooses to follow.

So will the controller blow away any partitioning that you've set up? Yes, but not automatically; with every controller I've ever used, the partitioning on the disk will stay there until you manually tell the controller to add the disk to an existing array. Are RAID controllers conscious of the fact that individual drives may be partitioned? No, they are not.

tsc_chazz
  • 2,941
3

So my question - if you add physical disks to a RAID controller will that RAID controller automatically hijack each physical disk and blow away/rewrite a single disk partition table such that it controls the entire device? Or are RAID controllers conscious of the fact that individual drives may be partitioned?

No and no. Most of them doesn't care about the contents of the disk, except for their RAID superblocks. They don't interpret partition tables; the partition table is no different to the RAID than other data, and it happens in the RAID array data ares.

They care about that if data is written to, say, two-disk RAID1, it would be written to both, if read — read from either, and if there's a problem the read will be redirected to other one.

If the disk has data, it may be be erased (by "initialization") or retained during the creation of the array, you can choose either way. If you retain, since virtual disk would be of different size than the raw device (slightly smaller for 2-disk RAID1, or, almost twice as large for two-disk RAID0, etc.) than physical disks, the partition table may become invalid (this mostly applies to GPT). If disks have different data and you chose to not erase data area, which one would be read will be decided at random, and RAID check will reveal and report this, arguably, very undesired situation. So you should only choose to not erase if you are sure disks contain the same/synchronized data (in particular, they are brand new and filled with zeros and you are building RAID0 or RAID1; for RAID5 and 6 you must erase/initialize brand new, since their parity data is not zero when the array is zeroed).

3

Extending the other answers: important is to see, what is a disk.

A disk is a set of data blocks, which we can read and write.

That is all and no more. Anything more of it is only a trouble source.

Nothing obligates us to even have a partition table, any format of partition table, on the disk and in many cases, it is not.

Having partition table, and partitions is already an abstraction: to have multiple disk-like things (partitions) over a single physical disk.

Raid does not need this all. It could, and some nightmare-ish raid controller would be imaginable whose behavior is affected by a partition table of the child nodes, hopefully no one of us will ever need to deal with such a thing.

peterh
  • 5,017
0

A traditional hardware RAID is filesystem agnostic, it works at block level. It presents its array to the OS as a single device, which can then be partitioned and formatted.

When you add a disk, the controller will write data to it according to the schema of the array, usually writing across the disks in a stripe 128-256kb wide. That stripe contains the partition table, the partitions themselves, everything. As far as the OS is concerned it's dealing with a single disk, as far as the RAID controller is concerned it's just distributing data across the disks and doesn't care what that data is.

Chris Cox
  • 101