1

I have a bunch of drives of different sizes. In order to get them relatively aligned from a size perspective, I created a volume group. So the drives I have for the array are:

  1. 1400GB (Linux)
  2. 1200GB (LVM)
  3. 931GB (Linux)

The output of MDADM is:

sudo mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sda /dev/mapper/smalldisks-smallvolume /dev/sdb
mdadm: size set to 976631296K
mdadm: automatically enabling write-intent bitmap on large array
mdadm: largest drive (/dev/sdb) exceeds size (976631296K) by more than 1%

My understanding is that (assuming all the sizes are the same or within 1%) the total available size of the array is: (1400 + 1200 + 931) - 1400GB for parity. Why then is the size being set to 976631296K?

From another answer I read that if the sizes are outside of the 1% threshold then the smaller disk size will be used.

Does this mean that if my drives are not exactly the same size (or less than 1% different) then no matter how many disks I add to the array, it will only ever be the size of the smallest disk?

What do I need to do in order to get my largest drive as the parity and the 2 smaller drives added together as the capacity of the array?

4
  • You understand wrong I'm sorry. See How to calculate the final raid size of a Raid5 array. Your size would be (N-1) x S(min) = 2 x 931GB = 1862GB
    – derHugo
    Nov 13, 2017 at 7:20
  • Ok thanks, but why does mdadm only give me 970gb then? Nov 13, 2017 at 7:23
  • 1
    @DanielMinnaar *931 GiB.
    – muru
    Nov 13, 2017 at 7:29
  • To your second question: It is possible to join to hardrives to one logical disk (e.g. via LVM) but -> 3 disks is the minimum amount for a RAID5 so ...
    – derHugo
    Nov 13, 2017 at 7:36

1 Answer 1

2

There is a slight misunderstanding here. The size reported here is not the final, usable size of the RAID5 array, but the size of storage used from each device. See the description of the --size option:

-z, --size=
      Amount  (in  Kibibytes)  of space to use from each drive in RAID
      levels 1/4/5/6.  This must be a multiple of the chunk size,  and
      must  leave about 128Kb of space at the end of the drive for the
      RAID superblock.  If this is not specified (as  it  normally  is
      not)  the smallest drive (or partition) sets the size, though if
      there is a variance among the  drives  of  greater  than  1%,  a
      warning is issued.

This is exactly what you're seeing, including the warning.

What do I need to do in order to get my largest drive as the parity and the 2 smaller drives added together as the capacity of the array?

That sounds like RAID4, not RAID5.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .