Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

HI Guys!

I am working on Ubuntu 10.04 version.

I accidentally deleted my code from find -delete command.

Is there any way to recover the data?

Many thanks in advance.

share|improve this question

migrated from stackoverflow.com May 31 '11 at 14:12

This question came from our site for professional and enthusiast programmers.

3 Answers 3

Restore from backup. If you don't make regular backups, then sooner or later something like this will happen and you will lose data.

share|improve this answer

If you do a google for undelete linux, you will find a method of finding deleted file entries, however, while the system runs, there is every chance the space is overwritten. Having done something similar, in the end, I ended up using strings, and grep to extract the source from the disk, and then replacing a lot of the brackets and punctuation.

Undelete usually occurs on systems where they dont delete the file, they move it and hide it aka windows, unix was not designed to be that kind of system.

This works on ext2 (and is the method I mentioned to start with http://e2undel.sourceforge.net/recovery-howto.html) however, do be aware, it may not work.

Best way to get deleted files back on unix is to restore from a backup.

share|improve this answer

While it is possible (at least some parts) as already @BugFinder told. But for the future:

The first thing what you should do - remember it:

Immediately turn off your computer.

If you don't run mission critical database, the best is turning off from a power and not by regular shutdown or soo, because your shutdown maybe will write some data into (already freed blocks from the deleted files). And here is a chance, than your file-delete is not synced from the memory buffers into the hdd.

Ofc, you will get corrupted filesystem, but usually can repair it without problems (fsck) and you will do some voo-doo filesystem hacking with fsdb anyway... ;)

Backup frequently is a good idea, or use more intelligent OS/Filesystem combination. For example FreeBSD/ZFS. (I don't want start any flamewar, so please don't comment my last line). :)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.