TL;DR

You need to recover data from USB/Disk ? Try photorec. Install it with sudo apt install testdisk

The long story, if you’re bored

Well, today my dad called me, and very panicked told me “Son, my USB drive is not working anymore, I have plenty of PDF required for an important interview tomorrow, but I can’t open it anymore”

Usually when this kind of issues happen with my father, the issue is between the chair and the keyboard 🤫 but this time the issue was serious.

I plugged the USB, tried to get information about the filesystem or whatever with the usual fsck commands, but nope, the USB key was considered like a pill of random bytes.

I didn’t have a lot of time to investigate why/how, to check the partition - so i preferred to go the dirty way and try a recover tool. And here it is :

photorec

you can install it with

sudo apt install testdisk

This is a very straightforward and fast tool to recover your data. There’s a nice UI in the terminal. The unplanned thing is that i indeed recovered all the files on the key - even the deleted ones :) There were more than 550 PDFs found were my father was talking about around 20…

So i had to clean this up, it really depends on what you need to do. Here basically i knew that the biggest files were the one i was looking for. Also, there were a lot of strict duplicates, probably temporary saves. In that case, md5sum did the job and helped me trim all everything.