Recovering Deleted Data in Linux Ext3 Filesystem: Use Trash Can

Deleting Files to the Trash

As most of you know, Ext3 file system don’t have to be defragmented like the FAT32 or NTFS file systems. This is a nice feature – but this has a bad side effect as well. You cannot recover deleted files. This is a good trade-off in a server environment. Its not practical to run a defragmenter on a live server. It might take hours to complete – and disk access will not be allowed in that time. And most server environment have very strong backup mechanisms – so data recovery is not a big issue. But when it comes to the desktop environment, this is a very Bad Thing.

From a desktop user perspective, it is not a huge deal to run a defragmenter once in a while. I used to do it once every month or so when I was on windows. But accidental deletion is a huge problem as most desktop users don’t have a very strong backup system in place.

In Windows(FAT32 or NTFS) if you want a deleted file back, there are file recovery software available that might recover the file. There is a good chance of getting back the file in one piece if you try to recover the file soon. But this is not possible in Ext3 – the way the file system is designed makes it next to impossible. This is because the file system will overwrite the deleted portions – to prevent fragmentation of files. The advantage of this method is that fragmentation will be avoided. The disadvantage is, well, you will not be able to recover deleted files.

Solution: The Trash

There is a very simple solution to this problem – but it is something no self respecting geek will use. The Recycle Bin. The Trash Can. Use it.

The problem is I have not seen anyone other than total newbies delete files into the Trash. Most people I know use the Shift+Delete shortcut to delete. I use a slightly different shortcut – Shift+Delete, Enter. That means I don’t even see the deletion confirmation prompt. And if when I delete something important, the only thing left to do is cry.

I have several backup systems in place – but you know the Murphy’s law when in comes to backups…

You have a backup of everything – except the file that was deleted

So, start using the Trash – do a delete instead of a shift+delete. I would advice removing the confirmation dialog on the delete action to make it go faster. You can do it easily in Konquorer…

  • Open Konquorer
  • Setting > Configure Konquorer…
  • Behavior > Ask Confirmation For
  • Make sure the ‘Move to trash’ checkbox is turned off.

I am sure this is possible in Nautilus as well – but I am not sure how to do it. If any of my readers is a gnome user, please post a comment on how to do it.

One last thing – remember to clean the trash once every two days or so.

13 comments

  1. Gnome default to no confirmation dialog. Why would you need it, when you can just recover from trash.

    Why do you think that one should clean his or her trash all the time?

  2. Yeah thats the point – if you use the trash, you can recover the deleted files easily.

    If you don’t clean the trash, the stuff you delete will still take up space on your hard disk. That’s why I recommend you delete the trashed files often.

  3. You Re 100% correct. As part of my setup of a new system, I do remove the confirm dialog from the Delete action, to encourage trashcan use. The only things that I Shift-Delete are very large files such as videos or .iso files.

  4. what I do is to make sure that rm command also moves the file to particular directory rather than deleting them, as and when necessary on the particular system. Then I have a cron running every second day to clean that directory. Works for me.

  5. I use trash…

    Nowadays (lessons learned) I refrain from rm(1) from the command line.

    The only thing I shift-del are movie files left over after converting them to a saner format, .torrent files that are completed. etc etc.

Leave a Reply

Your email address will not be published. Required fields are marked *