[SMB] HOW-TO RECOVER data from LVM volume on a PC (UX-500P)

Printers, HDDs, USB/eSATA drives, 3rd-party programs
alyf80
New here
Posts: 2
Joined: Fri Jan 23, 2015 1:50 am

Re: [SMB] HOW-TO RECOVER data from LVM volume on a PC (UX-50

Postby alyf80 » Sun Sep 06, 2015 11:10 pm

louiscar wrote:
alyf80 wrote:Having said that, the QNAP GPL tarball at http://sourceforge.net/projects/qosgpl/ contains all the relevant sources, so I was able to build a working recovery environment by compiling and installing QNAP's kernel and LVM tools on a standard system.


would love to have a bootable image of that recovery if possible for the more unix challenged amongst us or perhaps you could do a step by step tut for creating same?


What I cobbled together was more of a horrible hack than a real recovery environment; building something that can be used without a fair level of linux-fu would take a considerable amount of time, which I really don't have right now.
I can outlne the process, but you will probably have to adapt things based on your environment and any problems you might encounter.

Start with a clean linux install (you need persistent storage, so a live distro is probably not the best idea). I cloned a gentoo system I happened to have at hand, but any distribution should do.
You need a working development environment, so make sure you install the relevant packages (C compiler, binutils, glibc and kernel headers,...). I don't have a complete list, you will have to sort out the missing dependencies from any errors you get.

The first step is to install thin-provisioning-tools; these are just needed for a configure check so don't bother with the sources in the QNAP tarball: just installing your distribution's package should be fine.

From the tarball extract src/LVM2.2.02.96, configure it with --with-thin=internal, compile and install. If you get errors during the configuration or complilation, check your dependencies.

Now comes the fun part, i.e. the kernel.
Extract src/linux-3.12.6; for configuration I picked a default from the kernel_cfg folder in the tarball (I used TS870/linux-3.12.6-x86_64-hal.cfg, which is for an x86 NAS with specs reasonably similar to a recent PC) and adjusted it to include drivers for the hardware in my rescue system.
Everything you need (console, input, storage, network, ...) should be compiled in rather than built as a module: this is a rather ancient kernel and the userspace tools from your distribution might not play nice with it (in my case module loading did not work at all).

Compiling the kernel is a bit of a hassle, as QNAP seems to have sprinkled the sources with calls to code in a module of their own (picd) which is disabled in the configuration and cannot be enabled as it fails to compile.
I was not interested in debugging kernel build issues, so as a quick hack I left picd disabled and added

Code: Select all

#define send_message_to_app(...) do {} while(0)


at the end of include/qnap/pic.h, just before the final #endif; this effectively converts the offending calls to no-ops.

Then you need to reboot using the kernel image you just compiled; it might take some trials to get everything right, so be sure to keep the orginal kernel around so you can always go back and make changes.
At this point you should have a working system running a patched kernel and with a patched LVM installed; if all RAID volumes are connected and running, the usual

Code: Select all

# vgchange -ay


should not give any errors, and a subsequent

Code: Select all

# lvdisplay


should output a list of all your volumes in "available" state, which you can then mount.

Now, the usual disclaimers apply: this is what I did, and it worked for me. If you try to do the same and it kills your cat (or destroys your data), well, tough luck.
I did not write a detailed HOWTO for a good reason: if what I wrote above looks like gibberish to you, you should definitely not attempt to follow it.
Also, the method above is only intended as an emergency measure to gain read-only access to your volumes so that you can copy data off them. Do not mount the volumes read-write, and do not attempt any provisioning operations on the pools!

Hope this helps,
Andrea

User avatar
OneCD
Experience counts
Posts: 3235
Joined: Sun Aug 21, 2016 10:48 am
Location: over there, behind that sofa...

Re: [SMB] HOW-TO RECOVER data from LVM volume on a PC (UX-500P)

Postby OneCD » Thu Jan 05, 2017 2:39 am

Anika Alam wrote:Oh My god. I am just tired to read this. So sorry, can't provide any help.

Thank you for your contribution(?) :roll:

Please whine elsewhere.

I've switched to pure Debian on my production NAS (TS-569 Pro), with the backup NAS (TS-559 Pro+) to follow, so I'll no longer be able to use or support QNAP's firmware. This means no more closed-source software, "Malware Removers", etc ... If you have the means, I highly recommend it. Powerup/poweroff times are < 1 minute. :D

one.cd.only@gmail.com

dolbyman
Ask me anything
Posts: 6545
Joined: Sat Feb 12, 2011 2:11 am
Location: Vancouver BC , Canada

Re: [SMB] HOW-TO RECOVER data from LVM volume on a PC (UX-500P)

Postby dolbyman » Thu Jan 05, 2017 4:25 am

just a spambot raking up postscount for link spam

User avatar
OneCD
Experience counts
Posts: 3235
Joined: Sun Aug 21, 2016 10:48 am
Location: over there, behind that sofa...

Re: [SMB] HOW-TO RECOVER data from LVM volume on a PC (UX-500P)

Postby OneCD » Thu Jan 05, 2017 4:31 am

dolbyman wrote:just a spambot raking up postscount for link spam

I think so too. Other post from this 'person' looks like generic bot garbage.

Has there been any discussion from the forum admin about changing the signup process to limit bots? :S

I've switched to pure Debian on my production NAS (TS-569 Pro), with the backup NAS (TS-559 Pro+) to follow, so I'll no longer be able to use or support QNAP's firmware. This means no more closed-source software, "Malware Removers", etc ... If you have the means, I highly recommend it. Powerup/poweroff times are < 1 minute. :D

one.cd.only@gmail.com

P3R
Ask me anything
Posts: 8801
Joined: Sat Dec 29, 2007 1:39 am
Location: Stockholm, Sweden (UTC+01:00)

Re: [SMB] HOW-TO RECOVER data from LVM volume on a PC (UX-500P)

Postby P3R » Thu Jan 05, 2017 5:02 am

Some posts by this spammer was removed, why not all of them and why isn't the account terminated?
RAID have never ever been a replacement for backups. Without backups on a different system (preferably placed at another site), you will eventually lose data!

A non-RAID configuration (including RAID 0, which isn't really RAID) with a backup on a separate media protects your data far better than any RAID-volume without backup.

All data storage consists of both the primary storage and the backups. It's your money and your data, spend the storage budget wisely or pay with your data!

User avatar
OneCD
Experience counts
Posts: 3235
Joined: Sun Aug 21, 2016 10:48 am
Location: over there, behind that sofa...

Re: [SMB] HOW-TO RECOVER data from LVM volume on a PC (UX-500P)

Postby OneCD » Thu Jan 05, 2017 5:20 am

P3R wrote:Some posts by this spammer was removed, why not all of them and why isn't the account terminated?

+1

I've switched to pure Debian on my production NAS (TS-569 Pro), with the backup NAS (TS-559 Pro+) to follow, so I'll no longer be able to use or support QNAP's firmware. This means no more closed-source software, "Malware Removers", etc ... If you have the means, I highly recommend it. Powerup/poweroff times are < 1 minute. :D

one.cd.only@gmail.com

User avatar
marshalleq
Easy as a breeze
Posts: 285
Joined: Mon Jul 23, 2012 2:44 pm
Contact:

Re: [SMB] HOW-TO RECOVER data from LVM volume on a PC (UX-500P)

Postby marshalleq » Sat Jan 14, 2017 5:17 am

There is no like button in these forums, so I'm just going to say thanks to father_mande. :)

Great post!
TS669-L (3GB RAM) fw 4.3.2.0050 Build 20170104 with 4x4TB Seagate ST4000VN000-1H41SC43 2x2TB Hitachi HDS723020BLA642
QNAP UX-500P External 5 Bay USB3 Expansion Cabinet
Raspberry Pi 2
Mac Mini
Windows
Sabayon Linux
Ubuntu Linux
Android

Web
https://www.tech-knowhow.com

Twitter
@Marshalleq
@TechKn0wH0w


Return to “Hardware & Software Compatibility”

Who is online

Users browsing this forum: No registered users and 4 guests