32

I've been using Ubuntu 12.04 and accidentally deleted a folder using Shift+Del.

Does anyone have any idea how to recover the folder?

jokerdino
  • 41,000
  • 24
  • 132
  • 201
bitsbuffer
  • 1,277
  • 5
  • 16
  • 15
  • Try this http://askubuntu.com/questions/33800/how-to-recover-deleted-files-and-folders? – atenz Jun 14 '12 at 06:50

1 Answers1

35

Yes, you can use extundelete command. (extundelete is a utility to recover deleted files from ext3/ext4 partition.)

Note that the partition must be unmounted before you recover. In most cases, you will have to shut down your computer and boot using an Ubuntu LiveCD/LiveUSB to be able to this.

Steps to recover:

  • Install extundelete with:

    sudo apt-get install extundelete
  • Usage example:

    sudo extundelete --restore-directory /home/myself/Documents/deleted_folder/ /dev/sda1
  • The /dev/sda1 is the device name where the deleted data was.

ish
  • 138,666
  • 36
  • 303
  • 312
Frantique
  • 8,435
  • 35
  • 51
  • 9
    **Also note** that if installing extundelete touches the partition on which you want to recover data, the fact that changes were made to that partition *could* potentially make recovery more difficult. – user Jun 14 '12 at 12:02
  • @Frantique - I have run Ubuntu via LiveCD, but I can not install extundelete: E: Unable to locate package extundelete, how to solve this? – Ladislav Naďo Dec 11 '13 at 08:07
  • You have to enable universe repo to install it. – Frantique Jan 21 '14 at 15:15
  • Didn't work for me on a remote VM. Running from a rescue system I've got some kind of "segmentation fault" errors. fsck didn't help. After reboot the deleted directory was still missing. – Peter Gloor Feb 19 '20 at 14:11
  • When I try thjis, it gives me this answer. Any idea why? "extundelete: No such file or directory /dev/sda5 extundelete: No such file or directory when trying to open filesystem /dev/sda5" – pigwidgeon Nov 25 '20 at 12:12
  • @pigwidgeon: the answer is there. Do you see the sda5 in /dev/ directory? – Frantique Dec 02 '20 at 14:49