Friday, February 13, 2015

Speeding Up RAID Operations on Synology NAS


There are a few things you can do to speed up the process of RAID operations, SSH to your NAS as admin and enter the following commands (change md3 to your device):

# echo 100000 > /proc/sys/dev/raid/speed_limit_min
# echo 32768 > /sys/block/md3/md/stripe_cache_size

The first command increases the minimum “goal” rebuild speeds for when there’s non-rebuild activity. 

The second command increases the stripe cache size which increases sync performance by allowing a larger cache to synchronise the read and write operations on the array.  This is only available for RAID 5 volumes and it does decrease the amount of available system RAM but I never saw 100% utilisation on the DiskStation.

You can monitor the process with the following commands:

# cat /proc/mdstat
# cat /sys/block/md5/md/stripe_cache_size
# cat /proc/sys/dev/raid/speed_limit_min
It also works for speeding up volume consistency checks as they both read the same config. Remember the commands above will only set those options until the NAS is rebooted.


Verifying the status of RAID arrays

We can check the status of the arrays on the system with:
1
cat /proc/mdstat
or
1
mdadm --detail /dev/md0
The output of this command will look like:

1
2
3
4
5
6
7
8
9
10
cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdb1[1] sda1[0]
104320 blocks [2/2] [UU]

md1 : active raid1 sdb3[1] sda3[0]
19542976 blocks [2/2] [UU]

md2 : active raid1 sdb4[1] sda4[0]
223504192 blocks [2/2] [UU]