While I was switching distros, I accidentally broke a partition. I’m almost certain that all the data is there, but it doesn’t have a filesystem (I used ext4). Is there anything I can do to fix it, similar to changing the file extension without changing the contents. PS: It’s a data partition. I was trying to resize it, accidentally also moved it to the left, found out that it was taking forever to move it, so I cancelled it. Finished the move to the left operation (I think), but it threw up an error about the filesystem. I don’t remember what it was, though.
Thanks to everyone who suggested Testdisk. It worked almost perfectly.
First thing is to not mount it at all. Any writes to the overwritten partition will corrupt your data.
Second thing: install system rescue cd to a live usb and boot it. Look into
testdisk
andphotorec
. It’s been a while since I’ve had to use these tools, but I believetestdisk
can restore the partition andphotorec
can find files in a file system that has been deleted. I would try runningphotorec
first to save the recovered files to an external hard disk, and thentestdisk
to try restoring them. But disclaimer: it’s been a while since I’ve had to do this, so my memory is foggy here.Good luck!