Linux – Is it possible to change the Raid5 chunk size of an existing device

hard drivelinuxmdadmraidsoftware-raid

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.

Best Answer

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).