Mittwoch, 15. August 2018

Replacing a drive by a bigger one on 2-bay Synology NAS

I have a Synology NAS 216play with two drives (2TB, 4TB) as individual drives.
I recently wanted to replace my 4TB HDD by a 8TB HDD. I wanted to keep my data in order to omit re-indexing all media. To my surprise I really couldn't find any decent tutorials or videos on how to do it excep for "back up the data, setup the NAS from scratch and restore it".

Well, I found a more elegant solution.
Notice: This tutorial only works if you have your volume setup as "Basic".








Here's the plan:

Prepare

  • Most importantly: Do a backup of your data. In case something goes wrong!
  • Remove all drives BUT the one you'd like to replace by a bigger one. Don't worry about the Operating system, it's mirrored to all drives. You station will boot up no matter which drive you remove. 
  • Add the bigger (empty) drive in the slot
  • Boot up the NAS 

Clone the drive

In order to clone the drive we'll just setup a RAID1 (mirroring)
  • open the storage manager
  • Open the Volume Manager Assistant by clicking "Manage"
  • Change the RAID type to RAID1
  • Select your empty drive to be added
This process can take a couple of hours

Remove the smaller drive

It's not as easy as it sounds as we need to tell Synology that this drive is no longer part of the RAID. If you just remove it, it will complain that the drive is missing.

Login via SSH as admin

sudo su 
fdisk -l



Now you need to identify the smaller drive, in my case it's /dev/sda
In order to remove the device from the RAID Array issue the following commands if /dev/sda is the smaller drive:

mdadm --fail /dev/md0 /dev/sda1 --remove /dev/sda1
mdadm --fail /dev/md1 /dev/sda2 --remove /dev/sda2
mdadm --fail /dev/md2 /dev/sda3 --remove /dev/sda3

or these if /dev/sdb is the smaller drive

mdadm --fail /dev/md0 /dev/sdb1 --remove /dev/sdb1
mdadm --fail /dev/md1 /dev/sdb2 --remove /dev/sdb2

mdadm --fail /dev/md2 /dev/sdb3 --remove /dev/sdb3

Three times because it needs to be done for every partion on the drive. There are two system partitions and one data partition. Now the disk station will start an alarm beep because it's missing the drive. Continue to tell synology that only one drive is expected:

mdadm --grow --force /dev/md0 -n 1
mdadm --grow --force /dev/md1 -n 1
mdadm --grow --force /dev/md2 -n 1

You can now shutdown and remove the smaller drive. It should boot up perfectly fine on the new drive. 

Expand the volume

  • open the storage manager
  • Open the Volume Manager Assistant by clicking "Manage"
  • Expand the volume with unallocated disk space
This will grow the volume to take all available disk space. It only takes a couple of minutes. 

Shutdown the disk station and put the other drive back in. 
Done!