3

I have an existing raid5 device which I created using mdadm on Linux.

When I created the device I set the chunk size to 64 but I would like to test the performance of various sizes but I don't want to have to rebuild my entire system to do so.

If it is not possible to do it live then is it possible to do this by booting with a rescue disk?

Any advice on the steps how to do this, either live or with a rescue disk, will be greatly appreciated.

2 Answers 2

4

This question is fairly old and wzzrd’s answer was correct at the time of writing. However, support for reshaping MD arrays has been added in the meantime.

Now, it is possible to change the chunk size of an existing RAID array by running

mdadm --grow --chunk=128 /dev/md0

In this example, the chunk size of /dev/md0 would be changed to 128 KiB. Please note that changing the chunk size is a very slow process because this involves rewriting all data that is stored in the RAID array. As this is done in a way that ensures data safety even in case of a system crash, each piece of data actually has to be written twice. Therefore, you should expect this process to take quite a while (in the order of days).

4
  • For some reason this command changes my RAID0 to a RAID4.
    – Elliott B
    Oct 18, 2018 at 6:39
  • That's strange. According to mdadm's man-page one can only change between levels 0, 1, 5, and 6. Have you tried explicitly changing the level back to 0? Oct 19, 2018 at 9:20
  • I did try, but it's stuck initializing for a long time, so I just how it away and started over.
    – Elliott B
    Oct 19, 2018 at 15:09
  • My experience has been that MDRAID always shows a RAID0 array as RAID4 during a reshape but it will switch it back to RAID0 when it is done. May 24, 2023 at 13:24
1

A 'chunk' is the part of a stripe that is written to a single disk. Your current setup is written onto the disk like something along the lines of this (assuming a three disk RAID5):

| data   | data   | parity |
| parity | data   | data   |
| data   | parity | data   |

In your case, each 'data' or 'parity' part (i.e. 'chunk') is 64KiB, which gives you a stripe width of 192KiB, which is fairly normal.

At this point, I don't think you can switch the chunk size.

What you can do though, is find out what the optimal chunk size for your system would be, without having to test all possible options. If you monitor your system with sar for a while, you should be able to find something called the 'average request size'. This number (sar displays it in in 512 byte sectors, iirc) is what the optimal size for the combined 'data' parts of a stripe is.

So, as an example, if your average request size is 64KiB (which is 128 sectors of 512 bytes) you will want to make the combined size of the 'data' parts of your stripe 64KiB. In case of a three disk RAID5 set, a chunk size of 32kiB would then be best.

You must log in to answer this question.

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