How to: Rescue QNAP Drives

How to: Rescue QNAP Drives

A post about how to rescue your information on QNAP Harddrives.

TLDR

  • fdisk -l
  • vgdisplay
  • lvdisplay
  • lvchange -ay
  • mkdir /mnt/harddrive
  • mount /dev/virtual-group-name-for-the-drive/logical-volume-id/mnt/harddrive


The Story


Last year i realized parts of our old fileserver was starting to fail and deteriorate. Partly I thought it was the actual QNAP Server hardware that was starting to fail, but I also suspected that some of the older hard drives where beginning to fail as well.

A lot of the harddrives where in different RAID's so even if one harddrive failed it would not be the end of the world, but, as we all know RAID is not BACKUP. So I started looking at different backup options (which I know we should have done from the beginning).

So, I started looking at options to backup to other QNAP Servers that we had, the problem is that the servers where bought at roughly the same time, and so I suspected that the other servers might also start to fail, especially if I put more strain on them by handling the backups of our other servers. Never the less this is where I started, I started trying to backup the hard drives to the other servers, however, as suspected, the initial server started to fail as we started the initial backups to the other servers, and then the other servers started to fail as the backups put more strain on them.

It's worth mentioning that during all of this, we weren't using the old fileservers very much and handled most of our file storage and file management in the cloud through either AWS or Google.

Anyway, as I saw that the servers started to give in even more and the backups to the other fileservers continued to fail and random. I decided to look for other options.

So I went ahead and bought a hard drive docking station, which i connected to a stationary NUC computer that we had lying around. After connecting it to the computer I took one of the drives from our QNAP server and docked it in the docking station to see if I could access the information in any way from the hard drive, since the initial QNAP server had given up completely at this point.

The NUC that was connected to the docking station had Ubuntu Server installed on it and so i started with a couple of commands to see if the operating system recognized the drive.

And so i started with the "fdisk -l" command in order to list the different drives on the operating system, I was in luck. The operating system had found the drive. In order to access the information on the disk however I needed to mount it. So I tried mounting the disk the usual way, by using "mount /dev/sdb/ /mnt/harddrive" command. However I got an error that said that the harddrive was busy or was already mounted.

So i went back and looked at the "fdisk -l" command again, to realize that the drive was actually mounted to another location called "/dev/md125" or something like that. So naturally my next go-to would be to mount that location instead by using the command "mount /dev/md125 /mnt/harddrive". Then i got another error saying that the system did not recognize the filesystem type "drbd".

After a bit of googling and troubleshooting i stumbled upon a link to the QNAP forum: https://forum.qnap.com/viewtopic.php?t=143408

After reading that thread I came to the conclusion that QNAP uses LVM and Raid partitions on their drive. So in order to access the information i would need make sure that LVM was installed on the server. So i ran "sudo apt-get install lvm2" in order to see if that was installed.

Through reading the qnap form thread i read that I needed to find out if there was any logical volumes installed. so then i rand the "lvdisplay" command in order to display the logical volumes, you should however also try the "vgdisplay" command in order to see which virtual group your logical volume is connected to. From that point i also understood from the forum post that the partion of the logical volume that i needed was going to be called something with "lv3" or "lv6".

so from there i tried to mount in my case "mount /dev/vg288/lv3 /mnt/harddrive" but yet again, i got an error saying that there was no mount point. This is because sometime it might be the case that the logical volume is existing but not yet activated. Which is why you need to run the command "lvchange vg288 -ay" in order to activate the logical volume. after that you should be able to run the mount command again.

Now I had access to all of my data from drive and was able to mount another NAS (Not QNAP this time, but Synology) and copy the data over to that server and from there use the application "Cloud Sync" in order to sync the data to the cloud and by that rescuing the QNAP drive and uploading it to the cloud.