Fixing QNAP Error - "RAID Size Expansion Failed"

I have just upgraded my QNAP TS-412 from 4 x 2TB drives to 4 x 4TB drives using the ([QNAP Wizard] and it worked all too smoothly until I hit the error "RAID Size Expansion Failed". This was after all 4 drives had successfully rebuilt individually and I was trying to expand the total size.

After some reading on the QNAP forums, here is how I solved it.

  1. From the web admin, close EVERY service running. I left SSH running, but I stopped; Microsoft Networking, Apple Networking, FTP, all apps, etc.

You can get a good list of what is still running via System Status > System Service.

  1. Grab any old USB key (mine was 4GB) and plug it in. You don't need to preformat it or anything, but you will lose anything on it.

  2. SSH into your NAS and run:

fdisk -l

You should be able to identify where your USB key is mounted (usually the last item). Mine was at /dev/sdi1.

  1. Prepare the USB to run as a swap file:

mkswap /dev/sdi1

  1. Set the as a swap file:

swapon /dev/sdi1

  1. Now if you go back to your 'Resource Monitor' you should be able to see the additional 4GB as a swap file.

  2. Try the expand again and it should all work :)

Bonus Points

I also sped up the whole rebuild process by modifying the minimum RAID rebuild speed.

Firstly, check what your minimum and maximum speeds are by SSH'ing into your NAS and using:

cat /proc/sys/dev/raid/speed_limit_min

cat /proc/sys/dev/raid/speed_limit_max

For me it was 1,000 and 200,000. So I could safely raise the minimum to 50,000 providing I wasn't hammering the NAS at the same time with other requests. You can set this by using:

echo 50000 > /proc/sys/dev/raid/speed_limit_min