A blog about the symptoms when Synology NAS malfunctions and how to recover data.

Environment Required:

  • Ubuntu version – 18.04 and above.
  • Only available on DSM version 6.2.x and above
  • Applicable – ext4 or Btrfs file system.

Synology Data Recovery for Disaster Scenarios

If your Synology NAS malfunctions, you can recover its data with the help of a PC.

There are some cases where your Synology NAS fails to boot normally, and you need to recover data from the Synology NAS. For the recovery, you may need to borrow a PC that has plenty of drive slots and can install multiple drives simultaneously. To help our users with this problem, we created a tutorial on how to recover data from a Synology NAS using an Ubuntu environment.

  1. Synology NAS is a storage server that consists of multiple hard drives. When you want to install drives, first make sure your PC has sufficient drive slots for drive installation and then install the drives into the slots on the NAS. Therefore, before starting NAS devices recovery, ensure that your PC has sufficient drive slots for drive installation. 
  2.  You need to remove the drives and install them in your PC to use as local drives. By re-partitioning the drives and installing the OS, you can use the drives as external storage devices or backup devices for your PC.
  3. To prepare an Ubuntu environment to test your NAS, follow the instructions in this tutorial.
  4. Go to the Files tab at the left bar and select Home.
  5. Navigate to the location where you want to place your copied files. Right-click and select New Folder, and then create one or more folders as mount points for accessing data.
  6. When you right-click on the new folder(s), it is a good idea to click Properties. The parent folder (aka mount point) will be something like {{{/home/ubuntu}}}.
  7. Find the Application Finder icon at the bottom left of your screen. > Type to search…
  8. Type Terminal in the search bar and press enter.
  9. Run the following command to obtain root privileges.
    sudo -i
  10. You’ll need to install mdadm and lvm2. These are the tools that will be used to manage the RAID array.

apt-get update
apt-get install -y mdadm lvm2

      11. Once you have removed all of the drives from your Synology NAS, enter the following command to see which models and capacities are available for re-assembly.
mdadm -Asf && vgchange -ay

       12. un the following command to get the information of ${device_path}.

cat /proc/mdstat
lvs
The command ‘pvs/vgs/lvs’ outputs the following device paths:

${device_path}
No lvs output /dev/${md}2
With lvs output /dev/${VG}/${LV}3

         13. The following is an example of the md status when a Synology disk array is in degraded mode:

Device Paths Classic RAID with single volume
cat /proc/mdstat root@ubuntu:~# cat /proc/mdstat

Personalities : [raid1]

md4 : active raid1 sdc3[0]

73328704 blocks super 1.2 [1/1] [U]

unused devices:<none>

lvs No output
${device_path} /dev/md4

14.

Device Paths SHR with single volume
cat /proc/mdstat root@ubuntu:~# cat /proc/mdstat

Personalities : [raid1]

md3 : active raid1 sda5[0]

73319616 blocks super 1.2 [1/1] [U]

unused devices:<none>

lvs root@ubuntu:~# lvs

LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert

lv vg1000 -wi-a—– 69.92g

${device_path} /dev/vg1000/lv

15.

Device Paths Classic RAID/SHR with multiple volume
cat /proc/mdstat Personalities : [raid1]

md3 : active raid1 sdc3[0] sdd3[1]

73328704 blocks super 1.2 [2/2] [UU]

unused devices:<none>

lvs root@ubuntu:~# lvs

LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy% Sync Convert

syno_vg_reserved_area vg1 -wi-a—– 12.00m

volume_1 vg1 -wi-a—– 30.00g

volume_3 vg1 -wi-a—– 30.00g

${device_path} /dev/vg1/volume_1

/dev/vg1/volume_3

           16. To avoid data loss, mount all the drives as read-only to access your data. After creating your device path in Step 12) in ${device_path} and mount point in Step 6)in ${mount_point}. your Synology NAS should be mounted at ${mount_point}.

$ mount ${device_path} ${mount_point} -o ro

            17. Double-check the files and folders you created in Step 5. to make sure they’re still there.

Note: 

If the above steps were unsuccessful, do not attempt to use other methods to retrieve your data. The best option is to seek the help of a NAS data recovery provider in Melbourne. However, it’s important to understand that you may not be able to recover your data

Also Read: DVR Vs NVR – What is The Difference & which is the best for your security system