How to rescue from “rm -rf /*”

Reading Time: 2 minutes

I installed Arch Linux 64bit on Raspberry Pi 4.

During this work I accidentally ran this command which shall not be…

rm -rf <Directory of Nextcloud>/*

This is actual command which I ran.
My intension is to delete data on SSD which isn’t related to Nextcloud.

As mentioned on above image I newly formatted by fdisk,

I saw unusual message Device or resource busy, The kernel still uses the old partitions., then I noticed that I had done something bad.

When I noticed I cannot be calm because I have over 200GB photoes/videos of my wife…

I could recovered somehow so I took note on here.

What I did

I used testdisk to recover.

I hadn’t known testdisk utility until this, I googled for solution for rm -rf /* and found.
– Sorry this is Japanese article.

I firstly used parted but didn’t work.
Then I installed testdisk and used.
Eventually almost data had recovered!

I missed to take screenshots, so I couldn’t attach them on here.
But testdisk seems to be famous application so I hope you can easily find how to use.


How was it?

Please don’t give up!