LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-25-2014, 07:09 AM   #1
harshaabba
Member
 
Registered: Aug 2009
Posts: 73

Rep: Reputation: -14
How ti recover deleted folder using 'rm -rf'


hi ,

I need some advice from you all regarding the following matter.

I had a important folder in my Desktop called "vas " (/root/Desktop/vas). However , accidentally vas folder removed due to scheduled job in crontab.

I used "rm -rf" command to delete log files inside the vas directory.Mistakenly ,entire vas folder deleted instead of log files.

How should I recover the vas folder again ? I don't have backup even

Thanks
 
Old 08-25-2014, 08:00 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
There are some tools which are intended to be run to recover lost data. The guides to using them typically benefit best with the following recommendations applied:
  1. Minimize any access to that disk as soon as you encounter a data loss
  2. Un-Mount the disk or shutdown as soon as possible
  3. Boot from somewhere else, such as a live USB distribution and not off of the disk where you lost data, do not re-mount it
  4. Run the recovery utility off of the alternately booted distribution; against that not-mounted disk.
  5. Note that whatever you use, likely will not recover all the data
  6. Time and amount of system usage makes a big difference; which is to say that if you kept your system running and did things with it; such as attempted to run the cron job which would access or create data in that directory, then good chance a large chunk of your deleted data may have been corrupted. Or if you downloaded and saved information to disk, it is also possible that your deleted data may have been corrupted.

Here are three links and my experience with this. Actually very recent, I had an rm -rf situation recently occur as well.

extundelete - For use with ext3 and ext4 partitions. Personally I've never had an ext3 partition, but I do have ext4. This worked best for me, it was my first attempt, the results stunk actually, but my belief is that the results actually were never going to be ever better than mediocre.

Undelete files on Linux systems - After my first attempt and finding that I didn't get much data, I tried this option. I probably should hesitate to even recommend it because it did not work; really it "told" me where there were problems but there was little I could do beyond what had already been done. I feel the overview is helpful and it does highlight some good understanding of what partitions really are on your disk.

Recover Deleted Files in Linux - This was my final attempt and I feel that it actually would work pretty good; however (and it's a BIG however) I feel that it is highly specific to certain file types. Such as it will find .DOC, .DOCX, .XLS, .XLSX, or JPEG, GIF, MPEG, and so forth; pretty much a TON of the common files one has for documents, pictures, ... professional or personal "data". My big however was that I'm a coder, therefore I have Makefiles, C, CPP, H, and so forth. It found ZERO of those files. Also things like .LOG, or .TXT, pretty much any type of file that is non-standard in the view of the creators of that tool. It has customization to concentrate on particular file types, I tried to give it C, H, and so forth; no joy. The customization is limited to the file types which that application already knows about. So it was a great tool, but I really didn't need all the images from my former browsing cache.
 
Old 08-25-2014, 08:57 AM   #3
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
i've had luck with photorec in the past.
 
Old 08-25-2014, 09:15 AM   #4
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
Quote:
Originally Posted by schneidz View Post
i've had luck with photorec in the past.
Photorec is in my third link. I should point out that Foremost was the one I was referring too which limited the file types. Photorec does work and does not limit the file types; I agree with schneidz and would recommend you try that first.
 
Old 08-25-2014, 01:39 PM   #5
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
next time do not use "rm -rf" without using extreme caution

Quote:
/root/Desktop/vas
and DO NOT !!!!!!
run the gui as root
that is a very BIG security BLUNDER

also DO NOT save things to the "desktop" folder

that is not a real folder but a decorative place for holding "*.desktop" launchers

Last edited by John VV; 08-25-2014 at 01:41 PM.
 
Old 08-25-2014, 01:53 PM   #6
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
another tip is to create an image of the volume with DD and run photorec on the image, rather than the original drive, and first and foremost, NEVER, EVER, E-V-E-R, try to recover data to the same volume from which you are recovering.
 
  


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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12: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
Open Source Consulting | Domain Registration