DiskTest Question & Writing Partition Manually

How to use TestDisk to recover lost partition
Forum rules
When asking for technical support:
- Search for posts on the same topic before posting a new question.
- Give clear, specific information in the title of your post.
- Include as many details as you can, MOST POSTS WILL GET ONLY ONE OR TWO ANSWERS.
- Post a follow up with a "Thank you" or "This worked!"
- When you learn something, use that knowledge to HELP ANOTHER USER LATER.
Before posting, please read https://www.cgsecurity.org/testdisk.pdf
Posts: 5
Joined: 24 Dec 2014, 18:53

DiskTest Question & Writing Partition Manually

#1 Post by Cyra »


I accidentally reformatted the wrong disk (why many of us are here) and am now attempting to recover the original partition tables and data. This is a GUID/GPT HFS+ drive for OS X. I have three main questions.

Question 1: How exactly does DiskTest determine the order in which partitions are found when in deep analysis mode?

Does it proceed sector by sector from the lowest number starting sector to the highest numbered starting sector? Or does it instead take into account ending sectors or size in some way when finding and listing partitions? Something else?

My reason for asking is that it seems to be finding possible partitions in that order, but it has not found a partition that I am quite certain exists at sector 409640. The highest starting sector for a partition that it has found so far is 143097925. If it finds partitions based upon their starting sector, then it would appear that DiskTest will never find my missing partition and I can quit the deep analysis. Is that correct?

This leads me to Question 2: If I am confident that I know, or can learn, the precise offset and size of each of the partitions that I had originally on my drive, can I then manually write that even if the deep analysis never finds the partition that I want?

If so, how exactly?

I think that I know where my partitions are based upon R-Studio for Mac. It listed the following in deep analysis of my disk (which matches the prior partitioning):

A) EFI Partition: Offset 40, total size of 409600. (so end of 409639?)
B) Data Partition: Offset 409640, total size of 1699417472 (so end of 1699827111?)
C) New Install: Offset 1700089256, total size of 253173728 (so end of 1953262983?)

My last questions are about understanding this data:
Am I correct in thinking that "Offset" means the start of the partition in sectors?
Am I correct in thinking that I need to add the Offset+Size of the partition, then subtract one to get the last sector in the partition?

If not, what should I be doing?

Thank you!

Posts: 5
Joined: 24 Dec 2014, 18:53

Re: DiskTest Question & Writing Partition Manually

#2 Post by Cyra »


1. Deep Analysis only took ~10 hours to complete for my 1TB disk. It appears the disk % indicator is bugged and I should have used the sector count to estimate time.

Also, it did find partitions at the end that it should have found far earlier if it went in sequential order. This question is answered.

2. I am still curious about this, as I was able to find all three of my partitions eventually with the deep analysis but then failed to write. I appear to need to wait for deep analysis to complete again in order to have another change to write the partitions.

3. I had the correct partitions:

What remains is that I received a "Write Error" when attempting to write those three partitions. I changed all three of them from D (Deleted) to P (Primary).

Was that a mistake? Should I have set them differently? How so?
A is a reformatted as HFS EFI partition, no files on it, not even the usual boot files.
B is an OS X installation that is bootable.
C is actually freshly reformatted and is completely empty.