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?

1

1 Answer 1

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.

6
  • 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, 2012 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? Dec 11, 2013 at 8:07
  • You have to enable universe repo to install it.
    – Frantique
    Jan 21, 2014 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. Feb 19, 2020 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, 2020 at 12:12

Not the answer you're looking for? Browse other questions tagged .