The ext3undel utility can recover accidently removed data on ext3 filesystems. Users can recover a specific file by name, or they can restore all files marked as deleted. ext3undel is a wrapper for other recovery programs such as Photorec, Foremost and SleuthKit.
Photorec is an awesome piece of software. Don’t tell anyone else about it. 😉
This will make my nast habit of holding shift when I delete something a little less drastic when I realize something important got selected.
I know I know, thats what the trash/recycle bin is for, but at the command line, anything will and does go!
Yeah I had the habit of using shift too, until I configured konqueror to ignore shift+delete, and I got rid of that crappy habit
But yeah from the command-line, either you have alias rm=”rm -i” or you really do have to be careful.
When did that become a nasty habit? I have never deleted a file I didn’t want to and I’d rather that than having files I don’t need piling up in a system folder. And there never is enough disk space to forget about the “recycled” stuff.
In the nineties it was the “Word” files, in the 00s it was the mp3s, now it is 4Gb DVD images or rips, or in my case 10Gb virtual machine drives – they somehow always manage to fill up your disk drive whatever its size.
When your doing system things you shoulden’t do after being up for a day and 1/2.
Couldn’t you set up a bash alias or function where rm is actually mv?
$ sudo aptitude install ext3undel
[…]
Couldn’t find any package whose name or description matched “ext3undel”
Couldn’t find any package whose name or description matched “ext3undel”
No packages will be installed, upgraded, or removed.
[…]
http://freshmeat.net/projects/ext3undel/
If this works, it’s no more ext2 for me. I never switched to ext3 because for some reason I never learned stop doing this…
$ rm * -R
Hmm, why did that take so long, did I forget something?
$ pwd
/home/righard
yes i did, damn
Put the following into your .bashrc and .bash_profile files:
PS1=”\u@\h:\w> ”
export PS1
alias rm=’rm -i’
alias cp=’cp -i’
alias mv=’mv -i’
set -o noclobber
The first two lines will set your command line prompt to show you which directory you are in. No more need for the “pwd” command.
The three “alias” lines will for you to confirm with a yes/no prompt before deleting, copying or moving a file.
The “noclobber” line will prevent you from overwriting an existing file. If you want to overwrite a file, you’ll have to manually delete the old one first.
Of course, you have to logout/login one time for these settings to take effect, because that restarts the bash shell.
I didn’t know about noclobber. I may use that. But, the “-i” stuff just gets on my nerves.
Here’s a tip for you. You don’t have to log out to reread the dot files. All you need to do is at the command prompt: “. .profile”. For clarification, at the command prompt, type a “dot” followed by a “space” followed by the name of the hidden resource file you wish to reread.
I just “source ~/.bashrc” which should source everything that normally gets sourced when you log in.
I got a bit excited when I saw this and immediately went to work installing the script and it’s dependencies. What I found is that it is entirely a crapshoot whether or not this thing will even be able to find the file you’re looking for. More often than not, it didn’t.
Edited 2008-07-16 17:20 UTC
You should be aware that the ext3 fs actually zero’s out the block pointers in the inode when a file is deleted, so file recovery programs/scripts are not very reliable. If your file spans several blocks and if it is a binary file forget it. If your file has some identifiable text you might be able to manually rebuild the pointers if you are lucky and have lots of time.
I have had the bad experience of dropping the wrong MySQL db and was unable to recover it. I had to completely rebuild all my work. However, before that I tried everything in my power to recover the old one. At the end of the day it was just easier to re-create it.
Edited 2008-07-16 19:40 UTC