Ade Malsasa Akbar contact
Senior author, Open Source enthusiast.
Sunday, February 28, 2021 at 22:34

I deleted my flash disk drive. There were many files and folders within it -- now they are gone. Don't throw away nor wipe it out first, that's the advice I often heard. The secret is, actually we can save those data -- this is called recovery or undelete -- with certain hardware or software. Fortunately, gratefully, there is the best recovery software on GNU/Linux we can use, that is Testdisk, that has a very high success rate and is able to recover my data. I managed to recover 100% of one of my important folders with it. Below I share with you how I use it. You can practice this either on flash drive, hard disk, or SSD. I wish you success!

Subscribe to UbuntuBuzz Telegram Channel to get article updates.

Preface

I deliberately sacrificed my "hard disk" (a 32GB EXT2 USB flash disk drive actually) by doing resizing and experienced fatal failure. My data inside were Kubuntu operating system and thousands of files (yes, I installed OS not within HDD but simply USB flash drive). I want to test the Testdisk Tool as many of my friends said using it they managed to recover their hard disks by 100%, 90%, or 80% or so. That's really nice and now is my chance to do it too! Please keep in mind that recovery does not guarantee 100% success and results may vary between us -- so do this at your own consent and responsibility.


Requirements

  • You understand your own filesystem (directory structure, folder names, hidden files, addresses of your disk partitions, etc.).
  • You have basic ability of Terminal's command lines.
  • If you don't, you ask a friend who does.

 

How To Play

- Press Enter and Q to go next and go back, respectively.

- Press P and Shift+C and C to list files, Copy selected files, and recover them, respectively.

- Use arrow keys to move selection.

- Press colon ( : ) key to select one file/folder.

- Red and green text mean unselected and selected, respectively.

- Read carefully text on bottom every time you select a thing.

 

Get Testdisk

Add the program Testdisk first to your computer.

$ sudo apt-get install testdisk


First Step

I scan my flash disk drive. This is to find deleted disk partitions.

- Run the command line. 

- Select [ No Log ], continue.  

- List of drives appear including the deleted drive.

- I select the deleted drive.

- Select [ Proceed ], continue.

- Select [ Intel ] if the Hint says Intel, continue -- choose accordingly. 

- Name of the deleted drive appears with list of commands underneath.


Second Step

I list my deleted files. This is to see the files and folders which are supposed to be deleted or wiped out.

- I select [ Analyze ], continue.

- Select [Quick Search] command, wait.

- Partitions in GREEN appear.

- Select the deleted partition.

- Select [ Deeper Search ] command, continue.

- Wait for the process to finish. This may take a long time.

- Once finished, list of partitions appear. 

- Select the deleted partition.

- Press P key.

- List of directories appears from that deleted partition.


Third Step 

Finally, I copy and paste, copy a deleted folder from deleted partition, and paste it to my laptop hard disk drive. Recovery done!

- List of directories appears. 

- I navigate to the directory and files I want to recover.

- I select a file by pressing colon ( : ) key, the file goes GREEN.

- I press Shift+C, now my Home file system appears.

- I choose a destination folder within my HDD filesystem.

- I press C to process the recovery and save the files in the destination.

- Wait for the process to take place. The screen will say "Copying, please wait... 9458 ok, 0 failed". This may take long time. 

- Once finished, the screen will say "Copy done!".

- Files and folders recovered in the destination folder.   

 

Results

Below are my recovered folders and files. I just need contents of my Documents (99% success) and Pictures (100% success) -- because my business and teaching data were there (including my GnuPG key). Finally I can backup my Ubuntu Buzz screenshots as well as sales data.

My recovered 'Documents' folder:


My recovered 'Pictures' folder:


My sales data fortunately recovered:


IMPORTANT: please take notes that recovery may not always 100% success. So there will be some inconsistency or errors such as this example above, some strange files incorrectly placed in that folder.


Afterwords

Recovery is highly possible with Testdisk. In my case above, I got 100% success rate. There is no guarantee we can always recover perfectly but it is certainly worth trying. Do not throw away, nor write anything into, nor wipe out a deleted hard disk drive you have! I wish you success.



This article is licensed under CC BY-SA 3.0.