Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 03-18-2008, 10:17 PM   #1
Registered: Jan 2008
Location: Indonesia, tanah air beta
Distribution: Knoppix v5
Posts: 97

Rep: Reputation: 15
Restoring files that has been deleted

How can i restore files that i has been deleted? Really, it was an accident... Anyone can help me?
Old 03-18-2008, 10:55 PM   #2
LQ Newbie
Registered: Oct 2006
Posts: 12

Rep: Reputation: 0
Restore a deleted file

I assume it was removed via rm or rm -rf?
There is no way ( that I know of ) to recover from that if you have turned off the computer. This is because any inode links will have been aged out and no longer available. In that case if you have a backup somewhere then that is the only recovery method available.

If your computer and session is still available where you did the delete then you could use: lsof
there should be a process id still available:
On command line issue:

$ lsof | grep filename( the one you deleted )

Assuming this came back with a value then you are in with a chance to recover.
in /proc there will be a file with the same process id number returned in above.

$ ls -l /proc/<pid>/..
$ cp /proc/<pid>/../<number> filename.recover
$ cmp filename.recover filename.orig ( whatever you really called it )

Assuming no complaints from cmp then you are back in business.

1. check out man lsof or even google it
2. If using rm use the -i switch to ensure you are prompted before the delete actually occurs.
3. These days storage is so cheap so I often find it better to just compress zip and archive stuff i no longer want. Then if after nn years I still dont want it then delete...

good luck and cheers
Old 03-18-2008, 11:07 PM   #3
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
You could start by indicating the filesystem that the files were on.

Then search on Google with that filesystem (e.g. fat32 or ext3) and the terms "undelete".

If another process doesn't have a lock on the file, then a program will need to locate the file from the filesystem and attempt to recover it. Such a program needs to understand the filesystem to be able to do this.

If the files are very important, you may want to create an image of the filesystem while it is off-line and then try to recover the files from the image file. This will prevent further writes from overwriting files.

If they were older files, the easiest way to recover them is by restoring them from your last backup.
Old 03-19-2008, 10:38 PM   #4
Registered: Jan 2008
Location: Indonesia, tanah air beta
Distribution: Knoppix v5
Posts: 97

Original Poster
Rep: Reputation: 15
unfortunately, i've turned off my computer >_<. I did it via rmdir <files> -Rvf. Thanks for powen. I'll careful for the next time. And forjschiwal, i'll try your suggest. I'll report to you as soon as i do that.


deleted, file

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
restoring files which were deleted by a mac coal-fire-ice Linux - Software 3 02-21-2008 01:32 AM
Help restoring deleted files/ mount question dlackovic Linux - Newbie 16 11-23-2007 04:31 AM
Restoring deleted files on ext3 jaa1180 Fedora 5 05-07-2006 10:19 PM
deleted xinetd, need help restoring bigVoice Mandriva 2 01-16-2004 07:27 AM
accidentally deleted files--need help restoring on reiserfs darksarin Linux - General 4 11-23-2003 07:13 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:20 PM.

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