LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-29-2017, 01:49 AM   #1
sse007
Member
 
Registered: Nov 2005
Posts: 43

Rep: Reputation: 15
Recovering ext2 file


I've moved a 5G file from one drive to another. After it's moved, turned out the destination drive has some hardware problem and the file is corrupted and the file on the original drive was deleted since the mv is completed. I should be able to recover it from the original drive since it is unmounted once the mv is done. I've tried extundelete but it only works on ext3 and ext4. I've tried testdisk but it doesn't see it. After some research, I am able to see it with debugfs (file attached). To recover the file, I can either reset the inode, block and dtime flags, or copy those blocks to another drive with dd. The problem is there are quite a lot of them and not all of them are continuous and I'm not good in scripting to do it. Is there any utility can do the recovery? Or any guru can help me with a script to recover the file?
Attached Files
File Type: txt restore.txt (68.2 KB, 27 views)
 
Old 03-29-2017, 06:59 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
I've only ever used PhotoRec, but it does work somewhat on deleted files. The case you cite seems to be ideal, you have the drive unmounted and haven't tried to write anything else to it as yet. A thing to check is whether or not PhotoRec can work on a limited directory on the drive it is searching, because it takes a long time and since it does not try to resurrect the directory structure, it will put together all file fragments it can and put them into many numbered sub-directories, so you'll get a lot of formerly deleted files back that you may not care about.
 
Old 03-29-2017, 09:35 AM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,780

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Does the "undelete" command in debugfs ("undelete <24577>") not work for that inode? It looks like enough information is there.
 
Old 03-29-2017, 03:17 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,991

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
Try testdisk also. You don't have much support in ex2 for this sort of recovery by design (or lack of design)???
 
Old 03-29-2017, 04:19 PM   #5
sse007
Member
 
Registered: Nov 2005
Posts: 43

Original Poster
Rep: Reputation: 15
That should work as I figured out using dump_inode -p <24577> to recover it. Didn't try undel yet before backing up that drive.

Quote:
Originally Posted by rknichols View Post
Does the "undelete" command in debugfs ("undelete <24577>") not work for that inode? It looks like enough information is there.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Advanced file attributes on file systems other than ext2 or ext3 gacanepa Linux - Newbie 1 11-25-2013 11:51 PM
EXT2 -fs warning (device sda1): ext2_fill_super:mounting ext3 filesystem as ext2 snakeo2 Linux - Newbie 6 11-19-2006 07:35 PM
recovering xfs volumes after ext2 formating Crypt Linux - Software 0 04-15-2004 09:27 AM
need help recovering files on an ext2 file system rmanocha Linux - Software 2 11-06-2003 10:37 AM
help!! recovering a ext2 fs NGraphiX Linux - General 2 05-13-2003 08:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration