Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I made the mistake of wiping out my entire project directory with a quick "rm -rf project".

Of course, the .hg directory went with it. I had about 15-20 changesets, that I have not pushed to anyone, and I would really really like to get those back.

The system is a Ubuntu machine, and the partiton where the delete happened is ext3, the project consist mostly of PHP files.

I know about the guideline to not write to the disk in question.

The first idea was to use the tool named scalpel, to get the PHP files back and diff them with the current version from the repo, and somehow carve the changes out. While it succeeded, it did not recover the file names (or there is a switch I'm missing), so I'm left with a few thousand sequentially named .php files, combing through them is not an option.

Can a kind soul please save me, and suggest a way to:

a) get the repo back, or

b) get the files back, with filenames

For those wondering how I did such a stupid thing:

I was working on a file in Vim which I wanted to remove from the repository:

:!hg rm %

This complained that the file is in a subrepository, so I specified the following:

:!hg rm % -R engine

which complained that file has modifications, use -f to force. And this is when somehow, I made up the following command:

:!rm -rf % -R engine

Somehow, seeing "force" makes me do a rm -rf by reflex.

share|improve this question
add comment

2 Answers

It's unlikely if scalpel worked that this will help, but you can try: http://www.gnu.org/software/ddrescue/ddrescue.html

In my experience if you've deleted it permanently (IE shift+delete in windows, rm -rf in linux) you are only able to do a raw recovery.

The raw recovery can usually only figure out what KIND of file it is, and sometimes the date it was last edited on.

I think you might be out of luck without doing a lot of detective and reconstructing work.

Good luck!

share|improve this answer
add comment

I feel you pain.

Check out Photorec. Don't let the name fool you - it can recover many types of deleted files from ext3 partitions.

Fingers crossed!

share|improve this answer
    
Ah - just seen the OP date! Ho hum. –  Linker3000 Jan 7 '11 at 22:48
add comment

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.