Data Recovery From the Terminal Using testdisk

Hi all,

I was doing a fresh install of Ubuntu on an old PC. This prompted me to look into utilities like ntfsfix and fsck. They did not work. An old post on the AskUbuntu Forum mentioned the testdisk utility and I tried that. The recovery ended up being successful. I documented it in a blog post. I’ll give a summary of the steps here and link the blog post I wrote so that you can read the entire process and see pictures if you need them.

Here are the steps I used:

  • Download the program with the sudo apt install testdisk command.
  • run the sudo testdisk command.
  • Click the disk you want from the list of disks the program finds.
  • Click the appropriate partition type .
  • Click Analyze on the next screen.
  • Select Backup on the following screen.
  • Press P on the next screen to go through your files.
  • Use the arrow keys to select the files you want to carry. Use the : key to select multiple files. Press the C button to copy out the files when you’re ready.
  • Navigate to the directory your backup lives in and press C again.
  • Wait for it to copy everything to the desired place. You’re done!

Here is the blog post.

https://matthewplascencia.substack.com/p/data-recovery-with-testdisk-on-linux?r=2f434c

If you liked the post make sure to keep an eye out. I might post new articles here when they’re on Ubuntu things so that you guys can learn from them.

Thanks for reading and I hope you learned something!

–Matthew

2 Likes

Thanks for sharing with the community :slight_smile:

2 Likes

Here is the blog post.
https://matthewplascencia.substack.com/p/data-recovery-with-testdisk-on-linux?r=2f434c

“Dirty”, in the filesystem context, means the last shutdown wasn’t clean, hence the partition wasn’t unmounted in an orderly fashion. Essentially it’s just the “mounted” flag, which only gets cleared at the last step of unmounting. It’s a simple fix within Windows, but one should not mess with NTFS from Linux, i.e. ntfsfix without doing some thorough homework, first.

And a backup is never unnecessary, BTW. Plenty of ways to shoot yourself in the foot at installation time, e.g. by selecting the wrong device to wipe for installation, which has happened to the best, as a matter of fact.

1 Like