LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-22-2013, 06:47 AM   #1
venkatp2013
LQ Newbie
 
Registered: Sep 2013
Posts: 1

Rep: Reputation: Disabled
Deleted Folder to recover


Hi,

Please command to recover the deleted folder in linux Redhat 6
 
Old 09-22-2013, 06:57 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Well, there is not a simple command to recover deleted files/folders. First of all it would be safer if you can umount the disk/partition to which the deleted folder belongs: this should prevent overwriting the disk sectors where the deleted folder is located. Then you need a recovery program like photorec/testdisk.

If the folder is located under the / partition (root) and you cannot umount it, better to run a LiveCD suite and install photorec/testdisk from there. Good luck!
 
Old 09-22-2013, 01:03 PM   #3
Z038
Member
 
Registered: Jan 2006
Distribution: Slackware
Posts: 835

Rep: Reputation: 165Reputation: 165
SystemRescueCD is a Linux live CD that has photorec already installed. I recently used it to recover some deleted files on a LUKS-encrypted LVM partition, and it worked fine.

The problem you are likely to have is that photorec can only recover files, not folders, and it doesn't recover meta-data like the original file names. It just searches free space on the disk for recognizable data. You'll need a different disk or partition for it to write the discovered files to. It creates directories named recup_dir.n where n is 1, 2, 3, etc., and puts hundreds of files in each one. It creates file names like f0127440.<extension> where <extension> is its best guess as to the file type, such as txt, c, h, java, xml, zip, etc.

If the disk you are trying to recover data from has been in use for a while, it's likely that photorec will find tens of thousands of files that it will organize into hundreds of folders with hundreds of files in each. Once you have that, you'll need to examine those files somehow (e.g., grep) to find the ones you're interested in. If the files you deleted were changed repeatedly, it's likely you'll find multiple revisions of each, and you'll have to try to figure out which version of the file to save.

If all the files you are trying to recover are of some easily recognizable type that photorec recognizes, you can limit its search to just those type files, which will greatly reduce the number of files you have to search through. Even so, you will likely end up with a lot of files to sift through in order to find the ones you want to save. It becomes a data reduction task of potentially enormous magnitude. It is not a trivial task, and it is likely to take a lot of time and effort.

photorec is a good recovery tool if you really have no other option, but it is better to take regular backups of your data so that you can just restore from the most recent backup.

Last edited by Z038; 09-22-2013 at 01:06 PM.
 
Old 09-22-2013, 05:37 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,394

Rep: Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207
testdisk may work.
 
Old 09-23-2013, 11:35 AM   #5
Z038
Member
 
Registered: Jan 2006
Distribution: Slackware
Posts: 835

Rep: Reputation: 165Reputation: 165
Quote:
Originally Posted by jefro View Post
testdisk may work.
testdisk is aimed at recovering lost or corrupted partitions. photorec is aimed at file recovery, which is what the OP wants to do. Both are written by the same author.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Recover deleted folder makowka Linux - General 2 11-23-2012 09:05 AM
how to recover deleted folder 124vikas.dange@gmail.com Linux - Software 1 09-09-2009 08:21 AM
How do I recover a rm deleted folder? CrownAmbassador Linux - Desktop 13 02-16-2009 04:54 AM
How to recover permanently deleted folder in linux megerdin Linux - Newbie 2 05-06-2008 05:46 PM
I have deleted a folder accidentally? How do I recover it? srikanth_dhondi Linux - Software 2 02-19-2008 07:38 PM


All times are GMT -5. The time now is 11:54 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration