Enlarging APFS OS Volume – Unknown partition scheme

apfsdual-boothigh sierrapartition

I have my OSX install on a seperate AFPS partion, my home folder on another (HFS). In order to enlarge it I deleted a Linux partition following it, and now I get an error that it is not an AFPS device when I try to enlarge it. Given some other users problems with rebooting when they have this unknown partition I'm wondering if I should be concerned. The output of diskutil list follows:

Last login: Thu Mar 19 15:22:12 on ttys000
User-MBP:~ username$ diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2: FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF               51.7 GB    disk0s2
   3:                  Apple_HFS Untitled                47.8 GB    disk0s3
   4:                  Apple_HFS Untitled                900.0 GB   disk0s4

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +51.7 GB    disk1
                                 Physical Store disk0s2
   1:                APFS Volume OS                      39.6 GB    disk1s1
   2:                APFS Volume Preboot                 21.6 MB    disk1s2
   3:                APFS Volume Recovery                512.0 MB   disk1s3
   4:                APFS Volume VM                      4.3 GB     disk1s4

Here is the output of diskutil info disk0s2 | grep -e Offset -e Size:

User-MBP:etc username$ diskutil info disk0s2 | grep -e Offset -e Size
   Partition Offset:         209735680 Bytes (409640 512-Byte-Device-Blocks)
   Disk Size:                51.7 GB (51722964992 Bytes) (exactly 101021416 512-Byte-Units)
   Device Block Size:        512 Bytes

Best Answer

You need to boot to macOS Recovery. Instructions for booting to macOS Recovery over the internet can be found here. Once booted to macOS Recovery, open a Terminal application window and enter the following commands.

diskutil unmountdisk disk0
gpt remove -i 2 /dev/disk0
diskutil unmountdisk disk0
gpt add -i 2 -b 409640 -s 101021416 -t 7C3457EF-0000-11AA-AA11-00306543ECAC /dev/disk0

After booting back to macOS, the commands given below will add the space formally used by linux to the partition where macOS is installed.

diskutil eraseVolume free none disk0s3
diskutil apfs resizecontainer disk0s2 0