Trouble with GUID HDD recovery in testdisk I had a power failure while using two of my hard drives (two WD Red 4 TB, each one nearly full, HFS+ data only, no OS on the drives) in a dock.

Since then I was able to recover almost all my files with DiskDrill but some are corrupted, some have lost their name and directory.

Since I have nothing more to lose here, I put my hands in it.

I am trying to rebuild the GPT with testdisk, but I failed several times.
So I've already written few times on gpt with testdisk, I've also tried the method using testdisk to find sectors of partition and pdisk to write them, but it failed.

Now I am trying again with testdisk and wxhexeditor. 

I am looking at every occurrence of "HFSJ", the first one match the sector testdisk had found 529400 (271430664 in hex).

But I can't find any EFI partition. Is there a way I can fix that? And rebuild GUID partition scheme?

Here is the result of sudo gpt -r show disk2:

start        size  index  contents
           0           1         PMBR
           1           1         Pri GPT header
           2          32         Pri GPT table
          34      529366         
      529400  7812357952      1  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  7812887352     1149783         
  7814037135          32         Sec GPT table
  7814037167           1         Sec GPT header


Follow-up: I tried what you recommend with the following result:

diskutil unmountDisk /dev/disk2
Unmount of all volumes on disk2 was successful
sudo gpt remove -i 1 disk2
disk2s1 removed
sudo gpt add -i 1 -b 40 -s 409600 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B disk2
disk2s1 added
sudo gpt add -i 2 -b 409640 -s 7813365344 -t 48465300-0000-11AA-AA11-00306543ECAC disk2
disk2s2 added
diskutil verifyVolume disk2s2
Started file system verification on disk2s2
Verifying file system
File system check exit code is 8
Error: -69845: File system verify or repair failed
Underlying error: 8: POSIX reports: Exec format error


this is beyond my understanding!
Initially partitioned with Disk Utility (as GUID pt, 1 partition, HFSJ) I would expect the partition tables of your WD Red 4 TB disks to look like this:

     start         size  index  contents
         0            1         PMBR
         1            1         Pri GPT header
         2           32         Pri GPT table
        34            6         
        40       409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
    409640   7813365344      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
7813774984       262151         
7814037135           32         Sec GPT table
7814037167            1         Sec GPT header


with the EFI = 409640 blocks and the empty default Apple spacer of 262144 blocks. All aligned to the 4096 Byte physical block size the resulting HFSJ partition starts at block 409640 and has a size of 7813365344 blocks.

You may just test this by removing the current partition (below I assume the disk identifier of the external drive is disk2 - use the disk identifier you have found in your environment):

diskutil umountDisk /dev/disk2
sudo gpt remove -i 1 disk2
sudo gpt add -i 1 -b 40 -s 409600 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B disk2
sudo gpt add -i 2 -b 409640 -s 7813365344 -t 48465300-0000-11AA-AA11-00306543ECAC disk2


If asked don't initialize any volume.

Now verify the volume:

diskutil verifyVolume disk2s2




After further investigations it turns out that one of the two external disks contains an additional recovery partition. After adding a 3rd partition like this:

     start         size  index  contents
         0            1         PMBR
         1            1         Pri GPT header
         2           32         Pri GPT table
        34            6         
        40       409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
    409640   7812357952      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
7812767592      1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
7814037128            7         
7814037135           32         Sec GPT table
7814037167            1         Sec GPT header


and the help of Disk Warrior (to restore broken file systems) both main volumes of the external disks have been salvaged.