OK! So you’ve accidentally deleted a partition. Step 1: NOBODY PANIC
Step 2: Don’t work on the live data!
If you have a large enough backup disk, attach it, and use ddrescue or testdisk to write a byte-by-byte recovery image file to some other location. You’ll use this for your work. I won’t cover that in my post yet, because I’m lazy. But that’s golden rule #2 - never ever work on live data.
Step 3: Profit! Just kidding. Step 3 is launching testdisk; Here we’ll create a recovery log.
Step4: Select the disk or disk image to recover.
Here, I’m lazy. I’ve erased the partition table from a USB disk. I’m just selecting my disk, but you’ll use your recovery image.
Step5: Select your partition type. If it’s an old style MSDOS partition table, select “Intel” otherwise you’ll probably select “EFI/GPT”. At the bottom, where it says “Hint:…” it should tell you what it’s detected.
Step6: Select Analyze.
Step 7: Perform a quick search.
Step 8: Now we’re cooking with gas! Looks like a partition was found!
Step 9: Select the partition for recovery and prepare to write it.
Step 10: Write your partition table.
Step 11: Look at those glorious files!