How to recover/ restore deleted files?

asked 2015-07-01 22:31:37 +0200

Anonymouse gravatar image

Hy,

I already asked this question in an existing thread, but did not get an answer. So i am trying my luck now here.

I accidentally deleted a file and want to recover it. Unfortunately I do not know the exact steps to do so. Can anybody give me a step-by-step-help or tell me, what I am doing wrong? Thank you!

I try to issue the command

btrfs-find-root /dev/mmcblk0p28

And get this long list:

Well block XXXXX seems great, but generation doesn't match, have=N, want=YYYYYY level 0

And after some fiddling I tried:

 btrfs restore /dev/mmcblk0p28 /mnt/restore

And got:

  /dev/mmcblk0p28 is currently mounted.  Aborting.

Being a linux noob I started in recovery mode, hoping to circumvent the mount problem - I do not know how to mount or unmount the file system... Now in Recovery Mode I selected option 4 for the bash and used the command:

  btrfs restore /dev/mmcblk0p28 /mnt/restore

Which gave me no errors. But I did not get any file either. I also tried the command

 btrfs restore -t N /dev/mmcblk0p28 /mnt/restore

But whatever N I tried I would not get anywhere. I am a total noob with this.

Please, can anybody help me recover the file step by step? I do not know how to get any further... Thanks!

edit retag flag offensive close delete

Comments

1

This might help you http://comments.gmane.org/gmane.comp.file-systems.btrfs/22560

Or at another point btrfs restore -r <subvol-id> -t <N> -v --path-regex '^/(|dir1(|/dir2(|/dir3(|/.*))))$' /dev/mmcblk0p28 /mnt/restore no idea what the subvol-id is but that you will find yourself I guess and you probably want to mount a 32gb sdcard to /mnt/ before you attempt to do that (not sure you will get anything out of it when you recover to a tiny FS)

chemist ( 2015-07-02 00:28:39 +0200 )edit

Thanks a lot for your help (and sorry, for my late answer). But like I said, I am no pro and do not even know what to do with the script ^^. I need unfortunately a step-by-step help. Otherwise I am lost... I do not even know how to recover the data to the microSD-Card - should I ever find my lost file again.

Anonymouse ( 2015-07-05 22:18:30 +0200 )edit

@chemist Thanks for the post regarding Jorg Walter's undelete script here. Ran btrfs balance as Jolla was getting really unresponive and had Gallery open at the time, now I have no photos or ambiances. I have three questions please: Firstly the script has some user info but if I wanted to recover .jpg (as in all pics) dirname "$0"" would be /home/nemo "$0"" and file="${file#/}" would be file="${.jpg#/}" to get lost Jolla camera pics? Second can I run the script again to find .png pictures with *.png replacing *.jpg? Lastly the only time to replace text in the script is dir=.... and file=.... (x2) ? Thank you or anyone else who comes to my rescue in advance.

rmitchell006 ( 2015-12-12 07:39:40 +0200 )edit

Are the files really missing or is just tracker misbehaving (tracker-control -se or tracker-control -krs will reset tracker and reindex you also have a button in sailfish-utilities for that!)? And yes, you can replace the .jpg with any fileextension you are looking for.

chemist ( 2015-12-12 11:55:51 +0200 )edit

Cheers for quick reply. Pics are in the memory blocks but not accessible like the folder has been deleted and thus the pathways. So I took a punt and ran with what I said above. After running ./file.bin I get /bin/bash^M bad interpreter: no such file or directory. /bin/bash exists in root looking in Filecase but no idea what it does.Ta. Would like to have this script available to all Jolla users for undelete of file(s) on /home/nemo/ so any help in fixing would be appreciated. Quality instructions and find+replace in Wordpad or other and ssh file in would be key to many problems :)

rmitchell006 ( 2015-12-12 16:09:40 +0200 )edit