Recover Data on Qnap with Photorec

Last week I got a qnap from a friend where multiple hard drives failed and he was not able to see the volumes with Qnap disk manager.  Having exhausted all the other options, we were willing to take up recovery.
The Tool that came to my mind first was photorec. Its open source, runs on Linux ( so I can run it directly on Qnap), and mounts your hard drive in read only mode so you are not making the situation any worse by using this.

Step 1 :  Get Putty and Photorec

You will need to get to the Qnap command prompt. Download Putty if you are on windows and connect to your Qnap using putty.
if you run uname -a on your qnap it will tell you that you are running kernel 4.2 so you can use photorec which needs kernel 2.6 or later
You will also need Photorec . Download and save it on an external hard drive/flash or on a network share that you can mount from Qnap you are recovery data on.

Step 2 : Prepare your media where the recovered files are to be saved

If you have a large External Hard drive, you can save your Photorec on this  and save the recovered files on this too.
If not, you can mount any network drive in your Qnap and save files on that. This is what I did for my friends Qnap as his HDD size was 6TB and I couldn’t find an external hard drive large enough to fit all the data.
You can mount any other qnap or windows share by first creating a directory and then mounting your share to this directory. You need ato save data on a drive other than the one you are recovering from.
mkdir /mnt/recovery
mount -t cifs -o username= <yourusername>  <ipaddress/path_to_sharedfolder>  /mnt/recovery

Step 3 : Run photorec recovery and wait for it to finish.

Insert your External Storage into the USB slot of Qnap and check if this is detected and the device name this is given.
cd /share/external
ls
here you will see some device with DEVXXXXX , this is your external drive. cd to this directory, your photorec directory and run photorec_static
If you get permission denied, you would have to change it to executable first.
chmod 777 photorec_static
run it by running ./photorec_static
Rest is all wizard based, you will have to select your hard drive , or your raid and select where to save the files.
your single hard drives will be named  sda, sdb, sdc etc
Raids will be md0,md1 etc
Thin Volumes will be cachedev1, cachedev2 etc
What is important is to select your external drive ( /share/ext/DEVXXX)  or your mounted network drive ( which we mounted to /mnt/recovery) when it asks you where you want to store the recovered files to.  DO NOT STORE THEM ON YOUR EXISTING VOLUME

Optional : Use Screen Command to Run the Wizard so you can close your putty session and let is run in the background

Screen is preinstalled on Qnap and I like to use it for running commands that take long time.
Run screen it takes you to a new terminal where you can run all your commands. Run all the commands of step 3 in this terminal.
To return to your original terminal, press Control +A  , then press D ( as in Detach). This will detetch the screen and you will be back to the main prompt
Though you deteched from that screen, you didn’t kill it, so your process is running in that screen. To go back to the screen, type Screen -r
It will either show you a list of all the screens that are available to attach to , or reattach you to the screen if there is only 1.  It showed me the following output

There are several suitable screens on:
16993.pts-2.AJQNAP      (Detached)
19381.MYTRANSCODE       (Detached)

You can now to go your screen by typing screen -r 16993 ( the number before the dot) and it takes you to your screen.

Limitations of Data Recovery this way

  1. It doesn’t restore your directory structure.
  2. It doesn’t restore your file names
  3. Some files Meta data ( exif data in pictures for exmaple) may not be recovered
  4. Your data will be spread in several directories. I had 12,000 directories called recup_dir.xxxx
  5. There will be several possible duplicates. you can use findimagedupes on linux or a tool like Visipics on windows to elimiate duplicates

Install Transmission on Qnap with Docker the Easy way

Transmission is the favorite BT client for many , but Qnap doesn’t offer it in app center any more.  However Qnap now offers you container station in which you can run LXC or Docker container.  With Docker, you can very easily install transmission and several other applications Graphically , within minutes

Step 1.  Find The docker Image

  1. Click on Container Station
  2. Click on Create
  3. Search for “Transmission”
  4. Select the image from Linux Server
  5. Click on Create
  6. Enter the Name of your Container. Auto Start is selected by Default
  7. Set the CPU and Memory to half of what you have. This container takes very little resources ( less than 1% of CPU and RAM in my case) , but you can set the upper limit to 50% .

Step 2.  Set the Network to Bridge Mode ( with DHCP or Static)

You will need an IP address to access your transmission webfront. For this set the network on Bridge mode. Set it to DHCP if you have a DHCP server,or Static if you want to have a Fixed IP.

Step 3.  Specify your Config, Download and Watch Directory

You need to mount 3 directories.

/config  holds your configuration files.
/downloads  is where your downloads are saved
/watch is where you place new torrents.

You can skip mounting the config directory and it will by default create one for you.

For /downloads you would always want to mount a directory on Qnap.  I use /Download directory on qnap for downloading so I specified this. Further I created watch and config directories under download .

Step 4. Run the container, find the ip and access transmission webfront

Run the container and you can see its IP address in the console. In case you don’t see the IP address, you can click on terminal and run ifconfig command. It will open a new window with the output and you will have the ip address.

Use that ip address to access your transmission webfront with the port 9091.  ( for example 192.168.1.198:9091 )

There is no username or password required to login. If you want further security you can edit the /config/settings.json file to specify which ip address are allowed to login from, a username and a password

That’s all there is to running transmission on your Qnap. In next tutorial I will show you how to install couchpotato using Docker container on qnap.

Running Couchpotato on Qnap with Container Station

The Easiest Way to run Couchpotato on Qnap is with Container Station   The Easiest way is to use Docker on Container station, in this tutorial we used an LXC Container with full Ubuntu installation. We can instead use lightweight Docker container.

1. Create a Ubuntu Container on your Qnap

  • Open Container station on Qnap and click on create.
  • Search for Ubuntu Image
  • Click on Install
  • Adjust your CPU and Memory Settings
  • Set Your Network on Bridge Mode ( DHCP or Static)

This is your container in which you will install Couchpotato. Its a python script to first you will need to have python on your system. It needs python 2.7 ( not python 3).

2. Install Python on your container

Install python by running  these commands inside your container.  default username and password are ubuntu:ubuntu , which you are reminded in the terminal window .

sudo apt-get update
sudo apt-get install python

check if you got the correct version by running python --version. it should report 2.7.x

3. Install git on your container and Clone Couchpotato

You will use git to get couchPotato to your container, so you will need to have git installed on your container first. do it by running

sudo apt-get install git-core

Once Git is installed you can clone couchpotato.  go to any directory you wish to save the couchpotato in ( I use /usr/local/bin) and run

sudo git clone git://github.com/CouchPotato/CouchPotatoServer.git

4. Run Couchpotato and Access its webfront 

To run Couchpotato you can run

python  /usr/local/bin/CouchPotatoServer/CouchPotato.py 

You can access the webfront in any webbrowser by visiting <containerip>:5050

In the next article I will post how to install Transmission on Qnap using Container station. Your Couchpotato can use transmission to download files.

Joomla Error “The file Cache Storage is not supported on this platform”

Problem :
After backing up your Joomla Installation with Akeeba Backup , you are trying to restore it using kickstart.php. You get the error “The file Cache Storage is not supported on this platform.”

Cause :
Akeeba has skipped tmp and cache directory from backingup. The sytem is trying to find the cache directory but can’t.

Solution :
Create your cache directory under the root name it cache and the problem should Go away.

Synology RT-2600 With Etisalat.

Synology RT-2600 Router is based on the Synology SRM OS. Like Synology NAS , this OS is what makes this router really unique.

I have had it for almost a month now and this is the best router I have ever had. What I specially like is the Parental Control , internet time Restriction based on Device  ( No internet on Daughters IPad after 9 )  , Traffic Control ( Guaranteed Bandwidth to Youtube on Smart TV) and reporting.  Offcourse there is a lot more than you can do with it , which I currently don’t since I already have a dedicated NAS to do all those things.

The toughest part of configuring the router though is getting your Etisalat Settings.  To get it working for you, you would need 3 things

  1. Your PPOE Username
  2. Your PPOE password
  3. Your VLan ID

Username and passwords are easy to retreive. Call Etisalat ( 101) from your landline and choose the ‘Reset your internet password” option. It would ask for your registered mobile phone number and SMS you your username and password. Easy

Now getting the VLAN id is difficult. I tried reaching the customer care, but it takes time. First they will  run some tests for you , then tell you according to them everything should be working fine, and then put you in a queue.

In my old Router too this setting is hidden behind the asterix. And without this, you won’t be able to connect. I spent a whole day on this and even suspected that probably Etisalat does some MAC binding so your router’s MAC address is bound ( realized this is not the case when the Cloned MAC didn’t work either).

For Me a VLAN id of 30 worked ( some people on a forum said they tried 27-30 ) . For you it may be different and you would have to get it from Etisalat Customer Service if this range doesn’t work for you.

Click on ISP Settings (IPTV and VoIP). Click on Enable IPTV, select Manual mode and Enter your VLAN ID in VID under Lan1 (internet only)

Here is where you would have to enter all this information.

Click on Internet, select PPPOE as the connection type and enter your username and password