How can I rescue my old partition table please?

I have been trying Haiku. It was running from my USB flash drive.
I have opened a *.txt file stored on my SATA hard drive and then the OS got frozen.
After rebooting I am not able to acces my data stored on my HD. I looks like the partition and the data are still there but it woun’t mount it. Please help.

What kind of format does have the disk (MBR/GPT) and the affected partition (BFS, FAT, NTFS, etc…) ?

Are you trying to access your data from the OS that is installed on the hard drive or from Haiku on the USB drive? If it is the former please let us know which OS it is.

My quick guess would be that it is not a partition but a filesystem issue and that the filesystem is marked as dirty because it wasn’t unmounted correctly (due to the freeze).
But to go any further we really need the questions answered…

For rescuing the partition table you can use TestDisk program There is also live media (live CD/DVD/USB) with it preinstalled

I think it was fat32 but I am not sure. Gparted is not able to recognize the partition anymore.

I have been trying the 1st OS linux 1337 studio on the hard drive. The 2nd puppy linux on the hard drive. The 3rd Haiku on the USB drive.

I tried TestDisk before asking here, but in the pgm there are many options there. I did not play with that what i did not understood. TestDisk did not help me. I don’t know how to use that.

I used TestDisk to recover the partition table. Its site contains the documentation for the utility. Basically, you need to open the terminal and write:

testdisk <device name>

where <device name> is your hard disk, e.g. /dev/sda (you can consult the output of lsblk command to find out your hard disk name). After that TestDisk will guide you through process and ask questions sometimes.

At the first stage, TestDisk performs the quick test. Its result is the partition table discovered by the program. It asks you for confirmation. The second stage is more in-depth recovery of file system, you probably do not need it, so after the 1st stage you can stop execution (TestDisk asks you if you wish to perform each step).

I got stuck here… TestDisk after the deeper search offers only two options:
A: add partition, L: load backup.
I did not habe any backup. Is it the end of the story?

On the contrary, this is beginning of procedure. You are invited to press “Enter: to continue”.

Update: Just observed it is after deeper search. Well, try to press Enter to see what happens.

At that picture, testdisk is showing already a partition /dev/sda2.

Please, describe better which was the original setup. Did this hard disk had an OS installed, which, how were the partitions formatted, etc.

I can see recognized devices fd0 (floppy?) sda and sdb with partitions sda1, sda3 and sdb1, sdb2 at right side of desktop. I see partition sdb2 is mounted (and device sdb?).

Also I see TestDisk reports /dev/sda2 as a disk (CHS 3916 255 63), but it actually is a partition. Did you start the program this way?

testdisk /dev/sda2

This will not work. Instead, you should start it as:

testdisk /dev/sda

because sda2 is a partition of sda disk.

I don’t know if somebody told to OP already, but he should do a dd copy first before doing any changes on the disk.