Unable to mount partition
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!
Below is the output from the following commands.
diskutil unmount disk0s2
sudo dd if=/dev/disk0s2 bs=512 count=3 | hexdump -Cv
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
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