Figured it out. Had to reformat my hard drive. "oh no, my files!" Well, I was able to recover the lost partition because I made sure that the windows partitions would not encroach on my linux partition. If anyone else can't solve this problem and is facing the same fate I was, here's what I recommend:
Disclaimer: You could lose your data. Research what I'm saying here on your own as I don't know much about this. Goodluck!
You're going to need a live ubuntu bootable usb AND a windows installation. Ventoy lets you put both on the same drive.
- Get parted, and run
sudo parted /dev/[drive]
- I recommend using
unit s
to change the unit to sectors. It worked for me and it seems more accurate than MB but someone can correct me.
- Run
print
and make note of your partitions. (Where they end and start) you should also take note of the type of partition. You can use something like Gparted or disks to figure out the file system (ext4, FAT32, FAT16, etc) and the type (primary, extended, logical). You need this info.
- Now reboot ur computer into windows installation, and format the drive by opening a command prompt and running
DISKPART
LIST DISK
SEL DIS # (replace # with the disk # of the Windows disk from list in previous command)
CLEAN
EXIT
- Reboot into live ubuntu, and use our good friend
parted
again.
- Choose the same unit as before
unit s
- Use
mkpart
to recreate your partitions. For me I only wanted to recover my Ubuntu partition so I just ran mkpart primary ext4 [startsector] [endsector]
- Now you can shut down, and see if windows installation will go normally.
Note: I did NOT recreate my partitions before installing windows. I did step 8 before step 5. I didn't think of doing it this way at the time. I recreated my partition AFTER installing windows. My grub partition got overwritten because of that. But my files are fine