1

I've combined two partition formatted as NTFS for dual boot system with bootcamp. I did this while running windows using a special program to adjust partitions. but after a necessary restart according the program some texts rolled by. after that i lost access to the bootmanager and was unable to choice to boot to windows or Macintosh.

now I installed a fresh copy of mac os on the old partition where Windows was installed before. I figured out that the partition where my Mac installation was on still exists, but its name has changed to "Windows Recovery" somehow.

disk0s2 is for as far as I know still the partition where my files are on.

what I like to accomplish now is get access somehow to this partition and copy my files before completely format the whole disk and install a fresh installation of Mac OS.

please help!

screenshot of terminal

Below is the output from the following commands.

diskutil unmount disk0s2
sudo dd if=/dev/disk0s2 bs=512 count=3 | hexdump -Cv

Requested info

Requested info2

Below is the output from the command diskutil info disk0s2 | grep -e Size -e Offset.

   Partition Offset: 314597376 Bytes (76806 4096-Byte-Device-Blocks)
   Disk Size: 351.0 GB (351027175424 Bytes) (exactly 685599952 512-Byte-Units)
   Device Block Size: 4096 Bytes

enter image description here

enter image description here

Files and folders inside EFI disk

4
  • Add to your question the output from the command diskutil unmount disk0s2 followed by sudo dd if=/dev/disk0s2 bs=512 count=3 | hexdump -Cv. Basically, disk0s2 has the wrong GUID partition type in the GPT. However, before fixing this problem, I want to see if the header is correct for a APFS container. Feb 9, 2020 at 0:11
  • I'm not familiar how to answer to you're question, but I posted two screenshots in my original question. Feb 9, 2020 at 1:11
  • I can post the commands needed to fix your problem. It would be helpful if you could first post the output from the command diskutil info disk0s2 | grep -e Size -e Offset. Feb 9, 2020 at 1:42
  • jeffrey2@jeffrey2s-MacBook-Pro ~ % diskutil info disk0s2 | grep -e Size -e Offset Partition Offset: 314597376 Bytes (76806 4096-Byte-Device-Blocks) Disk Size: 351.0 GB (351027175424 Bytes) (exactly 685599952 512-Byte-Units) Device Block Size: 4096 Bytes jeffrey2@jeffrey2s-MacBook-Pro ~ % Feb 9, 2020 at 2:10

1 Answer 1

1

You need to enter the command given below.

diskutil info disk0s2 | grep -e Size -e Offset

You should see output similar to what is shown below.

   Partition Offset: 314597376 Bytes (76806 4096-Byte-Device-Blocks)
   Disk Size: 351.0 GB (351027175424 Bytes) (exactly 685599952 512-Byte-Units)
   Device Block Size: 4096 Bytes

You need to determine the offset and size in units of device blocks. In your case, the offset is 76806 Blocks and the size is 200000118784 Bytes/4096 Bytes per Block=85699994 Blocks.

Next, you need to boot to macOS Recovery. Basically, restart the Mac and hold down the +R key combination until macOS Recovery starts to boot.

From the menu bar, open a Terminal application window. Enter the following commands.

gpt -f remove -i 2 disk0
gpt -f add -i 2 -b 76806 -s 85699994 -t apfs disk0

Removing the APFS Container with the Untitled and Untitled - Data Volumes

The following commands can be use to remove this container. Here I assume you have booted from the macOS stored in the other container.

sudo diskutil apfs deletecontainer disk0s3
sudo diskutil erasevolume free none disk0s3

An alternative and perhaps safer way to remove this container would be to first boot to macOS Recovery over the Internet, a macOS installation flash drive or an external drive with macOS installed. Next, enter the following commands.

diskutil unmountdisk disk0
gpt remove -i 3 /dev/disk0.

Next, reboot back to macOS.

When finished, the drive will contain 150 GB of free space. This free space can be added to the remaining APFS container by entering the command given below.

sudo diskutil apfs resizeContainer disk0s2 0
21
  • @Jeffrey: You have already done some of these steps. Feb 9, 2020 at 2:28
  • OMG! at first when terminal answered "removed" after the first command I was a little shocked, but after the second command and restarted it started to load the correct version of Mac OS X YOUR'E AMAZING!! Feb 9, 2020 at 2:39
  • Is it okay to delete the two partitions where I installed the second Mac OS on? "Untitled and Untitled - Data" please check the picture above. Feb 9, 2020 at 2:44
  • The safest answer would be to boot to macOS Recovery over the Internet, a macOS installation flash drive or an external drive with macOS installed. Next, enter the command diskutil unmountdisk disk0 followed by gpt remove -i 3 /dev/disk0. Feb 9, 2020 at 3:11
  • This will delete the two unneeded partitions Untitled and Untitled - Data, but keeps the partitions we just recovered? Feb 9, 2020 at 3:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .