Failed attempt to fix macOS partition startup volume set to FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF

Solution 1:

You entered the following command. This command is wrong.

sudo gpt add -i 2 -b 409640 -s 372637568 -t 7C3457EF-0000-11AA-AA11-00306543ECAC disk2

You should have entered the command shown below.

sudo gpt add -i 2 -b 409640 -s 859181016 -t 7C3457EF-0000-11AA-AA11-00306543ECAC /dev/disk2

So, you need to reenter the following sequence of commands, where the last command has now been replace with the correct command.

diskutil umountDisk disk2
sudo gpt remove -i 2 /dev/disk2
diskutil umountDisk disk2
sudo gpt add -i 2 -b 409640 -s 859181016 -t 7C3457EF-0000-11AA-AA11-00306543ECAC /dev/disk2

Note: You may need to eject the external drive for the changes to take effect.

If you successfully enter the above commands, then the output from sudo gpt -r show /dev/disk2 should appear as follows.

          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  859181016      2  GPT part - 7C3457EF-0000-11AA-AA11-00306543ECAC       
      859590656  116920320      3  GPT part - 7C3457EF-0000-11AA-AA11-00306543ECAC
      976510976     262111         
      976773087         32         Sec GPT table
      976773119          1         Sec GPT header

Even if the above fix works out, this does not mean you should continue having two APFS containers on this external drive.

For example, if you need both Mojava and High Sierra installed on your external drive, then you should install both to separate volumes inside a single APFS partition.

How I verified disk2s2 is a APFS container partition.

I started with the Apple File System Reference. When a partition is a APFS container, then the partition begins with a container superblock (nx_superblock_t). This structure is described on page 25. The beginning of this structure is repeated below.

struct nx_superblock {
    obj_phys_t  nx_o;
    uint32_t    nx_magic;
    uint32_t    nx_block_size;
    uint64_t    nx_block_count;
              .
              .
              .
}
typedef struct nx_superblock nx_superblock_t;

You provided a hexadecimal and printable ASCII dump of the first 512 bytes of disk2s2. Using both your dump and the Apple File System Reference, I determined the following.

  • The value mx_magic should begin at hexadecimal offset 00000020 and should be the character string "NXSB". Your dump show this to be true.
  • The value of the field nx_block_size. This field is a 4 byte integer which begins at hexadecimal offset 00000024. This value represents the number of bytes contained in each APFS block. To read this value, you have to start with the raw 4 bytes from your dump, which are given below.

    00 10 00 00
    

    Next, the bytes need to be reversed. This is typical when Intel processors are used. The reversed bytes are shown below with the spaces and preceding zeros removed.

    1000
    

    This value can be converted from hexadecimal to decimal by using the Calculator application or by performing the math shown below.

    16*(16*(16*1+0)+0)+0 = 4096 bytes/APFS block
    
  • The value of field nx_block_count. This field is a 8 byte integer which begins at hexadecimal offset 00000028. This value represents number of blocks contained in APFS container. To read this value, you have to start with the raw 8 bytes from your dump, which are given below.

    fb c1 66 06 00 00 00 00
    

    Next, the bytes need to be reversed. The reversed bytes are shown below with the spaces and preceding zeros removed.

    666c1fb
    

    This value can be converted from hexadecimal to decimal by using the Calculator application or by performing the math shown below.

    16*(16*(16*(16*(16*(16*6+6)+6)+12)+1)+15)+11 = 107397627 APFS blocks/container
    

    Note: In the above equation, the hexadecimal letters were replace by their decimal equivalents. Below is a table of these equivalents

    a hexadecimal = 10 decimal
    b hexadecimal = 11 decimal
    c hexadecimal = 12 decimal
    d hexadecimal = 13 decimal
    e hexadecimal = 14 decimal
    f hexadecimal = 15 decimal
    
  • The number of logical blocks in the APFS container. Your posted output from the sudo gpt -r show /dev/disk2 commands shows the size of each GPT table (both Pri GPT table and Sec GPT table) is 32 logical blocks, Using this Wikipedia reference, I computed the logical block size, as shown below.

    (128 entries) * (128 bytes/entry) / (32 logical blocks) = 512 bytes/logical block
    

    Therefore, the conversion from APFS blocks to logical blocks can be determined, as shown below

    (4096 bytes/APFS block) / (512 bytes/Logical block) = 8 logical blocks/APFS block
    

    So, to convert the APFS container size to logical block, I needed to multiply by 8, as shown below.

    (8 logical blocks/APFS block) * (107397627 APFS blocks/container) = 859181016 logical blocks/container
    

    Note: This is the same as your original sudo gpt -r show /dev/disk2 command displayed for the size of the second partition.

Based on the above analysis, I concluded your disk2s2 was a APFS container partition and not a JHFS+ formatted partition.

However, if you still want to try setting to a JHFS+ formatted partition, substitute the command shown below.

sudo gpt add -i 2 -b 409640 -s 859181016 -t hfs /dev/disk2