This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes Linux / UNIX and the fly likes Recovery of file after removing it? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Recovery of file after removing it?" Watch "Recovery of file after removing it?" New topic

Recovery of file after removing it?

Minal Silimkar-Urankar
Ranch Hand

Joined: Nov 25, 2007
Posts: 136
If I removing a file using rm command, then "rm" command will delete a name-inode map from a directory.

Can I recover this removed file?

Minal Silimkar
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32609

Not easily if at all. If you have backups, you can do a restore from there. If not, you can look if there is a tool that can restore files (I don't know if there is one.) Even then, that assumes the file has been overwritten yet.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24193

Yes, Linux file systems aren't like FAT disks. The best thing to do in this case is IMMEDIATELY shut the machine off, and bring it up in single-user mode with the disk containing the deleted file mounted read-only (this may mean booting off of a CD, or even moving the disk to another machine.) Then you can dump the partition with the deleted file using "dd"; now you've got all the remaining data in that dump, and you can reboot the machine normally.

Now, if the deleted file was a text file, you can just search the dump file for some text you know was in the deleted file. If it was something binary, then there are a few programs that can help you examine the dump, depending on what type of file system it was. For an ext2fs partition, there's the "recover" command (Google "Linux recover deleted files").

[Jess in Action][AskingGoodQuestions]
Pat Farrell

Joined: Aug 11, 2007
Posts: 4659

most of the linux gui shells, gnome or kde, have a 'trash' folder, so you can 'undelete' from it. The shell 'rm' commands are pretty close to final. That's why God invented SVN
I agree. Here's the link:
subject: Recovery of file after removing it?
It's not a secret anymore!