*I am running DSM 6.2.3-25426 Update 2

After many months of filling up my 16TB RAID1 config, I am nearly out of space… as in something like 150GB free (.1%). Eek.

So, after some research, I find that the Synology can upgrade without any downtime from a RAID 1 config to a RAID 5. Perfect! This is exactly what I need.

I purchase two more Exos 16TB HDD, install them after powering down my NAS box and then after booting up I went to the Storage Manager and changed the RAID config to RAID 5. Selected the two disks I installed and we were off… until we weren’t, really.

This operation is called a ‘reshape’ and is a core piece of md, or mdadm, and works at a block level and can be very, very, very slow.

At this rate, it was going to take about 22 days. 22 days for a power outage (yes, I have a 30-40min UPS) or some other issue was just a little too much for my liking.

In another post, I talked about how to increase the RAID reconstruction speed, but this was not a reconstruction… this is a complete rebuild(bad term) from a mirrored set, to a 4 disk config with a parity check across the 4 disks… so those setting do very little as you can see. 30918 mins = ~22 days.

In this case, one item you can change to help with this is the ‘stripe_cache_size’. First, check your size with this command:

cat /sys/block/md3/md/stripe_cache_size

Keep in mind that md3 is my RAID array, yours maybe something else. (Look above at the reshape = 0.0%, you’ll see that is md3.)

Mine is 256K.

That is atrocious for many reasons. Let’s change that.

Here I changed it to 4096 (4MB).

3x improvement already!

This setting allows the array to use more memory for its stripe cache. By default, Linux uses 4096B pages. So if you 256 pages for the stripe cache, and have a 10 disk array, it would be 10*256*4096 = 10MiB of RAM. In my case I have a config for 4 disks, and set mine to 4096, so 4*4096*4096 = ~67MB of RAM. If you get too crazy (large) you could run into an out-of-memory fault.

After it settled I wanted to increase it again so I changed it to 16Mib of cache and achieved this! I was excited about this. (4*16384*4096 = 268MB – This increased my memory usage from 28% to 34% as reported by Synology, FWIW.)

40000K/sec – HUGE improvement over 8000K/sec

Check Read Ahead

One last setting I changed was the check and change the read-ahead:

blockdev --getra /dev/md0

Mine was set to 256.

Change it to 65536:

blockdev --setra 65536 /dev/md0

You will need to be sudo for this (sudo -i)

Best of luck! I do not recommend doing this to a live reshape, but I didn’t have much choice.

Final stable speed – ~50-55000K/sec