Using photorec via ssh on Synology DS213+

Using PhotoRec to recover lost data
Forum rules
When asking for technical support:
- Search for posts on the same topic before posting a new question.
- Give clear, specific information in the title of your post.
- Include as many details as you can, MOST POSTS WILL GET ONLY ONE OR TWO ANSWERS.
- Post a follow up with a "Thank you" or "This worked!"
- When you learn something, use that knowledge to HELP ANOTHER USER LATER.
Before posting, please read https://www.cgsecurity.org/testdisk.pdf
Locked
Message
Author
nomad
Posts: 5
Joined: 25 Jul 2016, 17:26

Using photorec via ssh on Synology DS213+

#1 Post by nomad »

On my Synology DS213+ (1x 4TB HD) i deleted 2 directorys with .raw images (Sony Alpha 57). I cross-compiled photorec for Synology DS213+ to recover the files.
All works fine via ssh. It will take nearly 80h to finish. I dont want to keep the ssh session and this notebook on till its finished. I usualy use strg+z to stop a process, set it to background and disown the PID. Then i can exit the ssh and the process works in background. I tried this with photorec. I can stop photorec and set it to background with ctrl+z and rund bg. But stops after few seconds with this error " [1]+ Stopped (SIGTTOU) sudo ./photorec". It stops because photorec writes to the terminal. I can fetch the process with fg.

How can i run photorec via ssh as a backgroundprocess?


nomad
Posts: 5
Joined: 25 Jul 2016, 17:26

Re: Using photorec via ssh on Synology DS213+

#3 Post by nomad »

Thank you for fast response. Screen is not available on DS213+. Seems i have to cross-compile it for the DS213+? Can i use the tool-chain i have downloaded to compile photorec?
(Example from here: http://www.cgsecurity.org/wiki/Cross_co ... nology_NAS, i grabed the tool-chain for ppc GNU/Linux synology_qoriq_213+)

nomad
Posts: 5
Joined: 25 Jul 2016, 17:26

Re: Using photorec via ssh on Synology DS213+

#4 Post by nomad »

I solved the problem by using tmux, a so called modern version of screen. Found it here :
https://synocommunity.com/ as ready to install package for the NAS. I also found there TestDisk as ready to install package.
All works fine now :D

simsal
Posts: 1
Joined: 28 Aug 2016, 18:46

Re: Using photorec via ssh on Synology DS213+

#5 Post by simsal »

I have also deleted a lot of raw pictures on my NAS, but I don´t know how to get them back.
Could you help me with instructions how to get them back with photorec?

nomad
Posts: 5
Joined: 25 Jul 2016, 17:26

Re: Using photorec via ssh on Synology DS213+

#6 Post by nomad »

Hi,

i installed photorec and tmux (keeps the photorec session alive when log off from nas). You can install photorec manually but its a bit tricky. I recommend to use the package from https://synocommunity.com/. You can find tmux too on this site as a install package. Search the site for install instructions. After installing :

1. Login via ssh to the nas (ssh from any other linux machine or putty from a windows machine).
2. Start tmux to run a virtual terminal.
3. In the tmux terminal go to your destination (depends on your system setting, for me it was in /volume1/photo).
4- Run photorec. Make your choice for settings (i used all default settings). I searched the whole disk. Select a folder where you store the backup files.
It takes a long time to finish the process. It show you the remaining time.
5. While photorec search and restore files you can press "ctrl+b" then "d" (means detach) to exit the tmux session without stopping it.
6. You can log off from nas.
7. After a while, login via ssh to nas.
8. Run tmux with the command "tmux attach" to join your last session.
9. If search process is finished, exit photorec.

There are many many files now somewhere in subfolders of your backup directory. I found out that my raw files were restored as *.sr2 files. I created a new-backup folder and copy the files to the new-backup folder.

10. Go to your backup directory, create a new-backup folder.
11. Search the files you want to recover. I knew the day of my photos i was looking for. I did:
find ./ -type f -name *.sr2 -newerat 2016-06-14 ! -newerat 2016-06-24 -exec ls -lahS {} \;
12.The files were stored in different folders. So i did:
find ./ -type f -name *.sr2 -newerat 2016-06-14 ! -newerat 2016-06-24 -exec cp -r {} ./new-backup \;
I found all the needed files now in new-backup folder.
13. Rename the files. I did:
for i in *.sr2; do mv "$i" "${i/.sr2}".raw; done
to change file extension.

puncha
Posts: 1
Joined: 19 Feb 2017, 03:10

Re: Using photorec via ssh on Synology DS213+

#7 Post by puncha »

nomad wrote:I solved the problem by using tmux, a so called modern version of screen. Found it here :
https://synocommunity.com/ as ready to install package for the NAS. I also found there TestDisk as ready to install package.
All works fine now :D
Hi Nomad,
I have DS412. I want to follow the path you went in recovering the files. Could you please tell me how you install testdisk to server, and then how did you use tmux to recover the files. I'm total fresher for these type of stuff, hence your step by step help would be highly appreciated.
Thanks.

nomad
Posts: 5
Joined: 25 Jul 2016, 17:26

Re: Using photorec via ssh on Synology DS213+

#8 Post by nomad »

All you need to know i wrote in the above comment #6.

Locked