You are not logged in.

#1 2011-02-22 19:09:18

SkyTod
Member
Registered: 2009-09-01
Posts: 226

Recover replaced file.

Hi dear all!
I replaced one file in ext4. And I can't find easy way to recover it. Can you help me? How can i recover it by knowing the path?

Offline

#2 2011-02-22 19:26:36

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Recover replaced file.

https://bbs.archlinux.org/viewtopic.php?pid=522648 - no easy way, I'm afraid.
If it's a text file and you just made a couple stupid changes, maybe you can undo them using you editor's 'undo' function.

Last edited by karol (2011-02-22 19:28:32)

Offline

#3 2011-02-22 19:34:43

SkyTod
Member
Registered: 2009-09-01
Posts: 226

Re: Recover replaced file.

I need to recover *.po file that Photorec doesn't support. Another recovery apps isn't suitable as for me. And I closed my editor.

Last edited by SkyTod (2011-02-22 19:35:19)

Offline

#4 2011-02-22 19:39:19

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Recover replaced file.

I don't know what editor you use and what settings, but I can edit a file, save it, close vim, reopen it and undo changes.

Offline

#5 2011-02-22 19:42:38

SkyTod
Member
Registered: 2009-09-01
Posts: 226

Re: Recover replaced file.

Even when you use mv? smile
this is another kind of situation.

Last edited by SkyTod (2011-02-22 19:43:49)

Offline

#6 2011-02-22 19:48:38

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Recover replaced file.

SkyTod wrote:

Even when you use mv? smile

vim creates backup files. foo~ is a backup of foo. Even if the original foo is gone - removed, the content replaced etc. - but the foo~ is still there, why not 'vim foo~'?

Offline

#7 2011-02-22 20:16:54

SkyTod
Member
Registered: 2009-09-01
Posts: 226

Re: Recover replaced file.

Because I've made:

mv file myfile

May we forget about editors and go ahead? Please. I really want to back it.

Offline

#8 2011-02-22 20:20:38

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Recover replaced file.

https://bbs.archlinux.org/viewtopic.php … 57#p895257
You didn't say what editor you use.
Yes, even after 'mv file myfile' you would have myfile~ with the last saved contents of myfile.


Sorry I can't help you.

Offline

#9 2011-02-22 20:25:32

SkyTod
Member
Registered: 2009-09-01
Posts: 226

Re: Recover replaced file.

Virtaal.

So is there no way to recover my file? I don't believe. I believe I don't know this way.

Offline

#10 2011-02-23 15:53:46

stqn
Member
Registered: 2010-03-19
Posts: 1,191
Website

Re: Recover replaced file.

If this is a text file and you remember part of it, you can use grep on the partition.

Offline

#11 2011-02-23 16:13:36

perbh
Member
From: Republic of Texas
Registered: 2005-03-04
Posts: 765

Re: Recover replaced file.

*chuckles*
One of the things I love about linux ... "you asked for it - you got it"
None of this "are you sure you wanna do it (yes/no)?" "really, are you quite sure (yes/no)?" *lol*
Yup - you make mistakes - but usually it hurts so much you only do it once!

Mind you - I just hate all these '~'-files all over the place, so the first thing I do is to disable it!
He he he - always fun to live on the 'edge' ...

Last edited by perbh (2011-02-23 16:18:03)

Offline

#12 2011-02-23 19:25:46

SkyTod
Member
Registered: 2009-09-01
Posts: 226

Re: Recover replaced file.

stqn wrote:

If this is a text file and you remember part of it, you can use grep on the partition.

What exactly, huh?

perbh wrote:

*chuckles*
One of the things I love about linux ... "you asked for it - you got it"
None of this "are you sure you wanna do it (yes/no)?" "really, are you quite sure (yes/no)?" *lol*
Yup - you make mistakes - but usually it hurts so much you only do it once!

Mind you - I just hate all these '~'-files all over the place, so the first thing I do is to disable it!
He he he - always fun to live on the 'edge' ...

Yeah-yeah-yeah, I made a mistake, my bad. And there is no problem in fact with this part. But! The tear is modern journaling file systems can't be repeated as easy as it possible — it's pity. sad

Offline

#13 2011-02-23 19:44:01

stqn
Member
Registered: 2010-03-19
Posts: 1,191
Website

Re: Recover replaced file.

SkyTod wrote:
stqn wrote:

If this is a text file and you remember part of it, you can use grep on the partition.

What exactly, huh?

Something like:

sudo grep -a -C100 "blah" /dev/sda2

Offline

#14 2011-02-24 13:34:43

SkyTod
Member
Registered: 2009-09-01
Posts: 226

Re: Recover replaced file.

And will it find removed file? I tried — nothing.

Offline

#15 2011-02-24 13:59:52

stqn
Member
Registered: 2010-03-19
Posts: 1,191
Website

Re: Recover replaced file.

SkyTod wrote:

And will it find removed file? I tried — nothing.

Hm... I've used it in the past to recover a deleted .config (kernel build options) file from an ext3 partition, but now when I try it with a test file in my /boot (ext4) grep doesn't find anything, even when the file isn't deleted... Not sure what's going on.

Offline

Board footer

Powered by FluxBB