Recovering Deleted Data in Linux Ext3 Filesystem: Use Trash Can

Written by BinnyVA on January 25, 2009 – 11:55 pm -

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.


Tags: , , , , , , ,
Posted in Configuration, Opinion, Troubleshooting | 13 Comments »