Lost APFS partition after resizing partition in windows I was trying to resize windows partition using EASEUS partition manager in windows to free up unallocated space so that I can extend APFS partition in macOS but I failed to boot into macOS after resizing.
Please help me! how to recover lost APFS partition?

Hex dump below.





Amans-iMac:~ aman$ sudo dd if=/dev/disk1 skip=335874048 bs=512 count=1 | hexdump 
Password:
1+0 records in
1+0 records out
512 bytes transferred in 0.001917 secs (267067 bytes/sec)
0000000 b9 e9 ff cb a4 6d fc f3 01 00 00 00 00 00 00 00
0000010 fc da 09 00 00 00 00 00 01 00 00 80 00 00 00 00
0000020 4e 58 53 42 00 10 00 00 29 ea 22 01 00 00 00 00
0000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0000040 02 00 00 00 00 00 00 00 d8 36 06 fb 2f 1f 42 7a
0000050 b2 90 f5 cc 5c 85 9f 36 13 6f 08 00 00 00 00 00
0000060 fd da 09 00 00 00 00 00 18 01 00 00 18 6c 00 00
0000070 21 3c 06 00 00 00 00 00 28 c9 05 00 00 00 00 00
0000080 70 00 00 00 18 0f 00 00 6e 00 00 00 02 00 00 00
0000090 bc 0e 00 00 5c 00 00 00 af 6b 00 00 00 00 00 00
00000a0 69 ad 04 00 00 00 00 00 01 04 00 00 00 00 00 00
00000b0 00 00 00 00 64 00 00 00 03 04 00 00 00 00 00 00
00000c0 a4 6b 00 00 00 00 00 00 a6 6b 00 00 00 00 00 00
00000d0 a6 0d 01 00 00 00 00 00 00 00 00 00 00 00 00 00
00000e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0000200
Your partition table seems screwed:

Your first partition on disk1 is a Windows Recovery partition, the second is an EFI partition. Then either Microsoft Reserved (E3C9E316-0B5C-4DB8-817D-F92DF00215AE), Basic data (EBD0A0A2-B9E5-4433-87C0-68B6B72699C7) or Windows Recovery (DE94BBA4-06D1-4D40-A16A-BFD50179D6AC) partitions.

But the hexdump of block 335874048 (the first block of the 6th partition) looks promising:

...
0000020 4e 58 53 42 00 10 00 00 29 ea 22 01 00 00 00 00
...



4e 58 53 42: magic string of an APFS container  
00 10 00 00: APFS block size: 4096  
29 ea 22 01 00 00 00 00 APFS container size in APFS blocks: 19065385 (=152523080 512-blocks)

After re-arranging the Bytes 29 ea 22 01 00 00 00 00 > 00 00 00 00 29 ea 22 01 > 00 00 00 00 01 22 ea 29, you can get the decimal value here: 




The sixth partition obviously has the wrong type!

The partition type has to be modified with gpt then:


Disable SIP in Recovery Mode (the recovery system version has to be 10.11 or newer)
Boot to your external drive or Internet Recovery Mode.
Open Terminal and get some details:

diskutil list
sudo gpt -r show /dev/disk1

remove the 6th partition:

sudo gpt remove -i 6 /dev/disk1

restore the same partition with the proper type:

sudo gpt add -i 6 -b 335874048 -s 152523080 -t 7C3457EF-0000-11AA-AA11-00306543ECAC /dev/disk1

check the APFS container

diskutil verifyVolume disk1s6

Enable SIP in Recovery Mode




The partition layout is still uncommon since macOS usually requires an EFI partition as first partition. 

The non-default layout may prevent firmware updates in the future!