3

For an experiment purposes, I need as many disks in a single system as possible. Since I have only six spare disks, I decided to partition them to 128 GPT partitions and create RAID0 array of one device using each partition.

The problem is that mdadm had created only 512 arrays /dev/md[0-511] and I cannot create any additional arrays.

After an attempt to create 513th array I get an error:

% mdadm -C /dev/md512 -l raid0 -n 1 /dev/sdd128 --force

mdadm: unexpected failure opening /dev/md512

Is it a designed limitation? Is there any way to bypass it?

4
  • 1
    Possible duplicate of What is the disk size limit for mdadm? Commented Sep 16, 2018 at 18:20
  • @IporSircer, no, the max number of arrays is different than the max number of component drives in an array, or the max size of an array or component device. Commented Sep 16, 2018 at 20:36
  • @sotona, do you need them to be MD disks? Why not just use those 768 partitions by themselves? If you need more, you might want to check LVM. I'd at least assume it can create more than 512 logical volumes, though I haven't tried... Commented Sep 16, 2018 at 20:39
  • @ilkkachu in fact I need those partitions to appear as some sort of separate disks Commented Sep 16, 2018 at 20:55

2 Answers 2

3

You have hit the maximum limit of /dev/md* arrays on a single Linux system.

This is related to traditional Unix device major & minor numbers. Originally, the MD RAID driver was assigned major block device number 9 (defined in /usr/include/linux/raid/md_u.h as MD_MAJOR), and that allowed a set of 256 minor device numbers, and thus 256 unique RAID array devices. (The canonical list for device number allocation is included in the documentation that comes with the kernel source package.)

This eventually proved insufficient, and a mechanism was developed to use one additional major number (known in kernel code as mdp_major) if more than 256 RAID arrays are needed. You can find the code for handling this in the kernel source file .../drivers/md/md.c. The mdp_major extra major device number is allocated dynamically from the dynamic major device number range (234..254, start from the top and allocate downwards).

To use more than 512 MD RAID arrays on a single host, this mechanism needs to be rewritten to use more than one dynamic major number if required.

0

There is quite a dirty workaround (works with latest kernels from 3.10.0-862.11.6 branch)

# echo md512 > /sys/module/md_mod/paramaters/new_array
# mdadm -C /dev/md512 -l raid0 -n 1 /dev/sdd128 --force

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.