Mac OS partition type change to Windows_LDM during boot camp resize

I tried to resize my windows Boot Camp partition size and somhow the process accendentitly convert the mac Os partition type to "Windows_LDM"

Any idea how to revert back the MAC OS partion type ?

I cant boot mac or windows at the moment!


I have attached image of my Mac pro


Thanks in advance

Posted on May 2, 2020 7:10 AM

Reply
Question marked as Top-ranking reply

Posted on May 23, 2020 7:36 AM

We need to create a MBR using GPT Fdisk. Let me post the steps in this reply shortly.


Rebuild MBR to match the new GPT information thus resetting the Hybrid MBR. Use defaults for other questions (like partition codes). The only values that need modifications are the Boot flags and step 10. Accept all other defaults that Gdisk offers. Please see the sample Q&A as an example. These steps can be repeated if you make a mistake before you get to Step 12, otherwise start from Step 1 for these steps. Step 6 has numbers which are typed with a space between the numbers. Please see the sample Q&A before you execute these steps.


  1. Sudo gdisk /dev/rdisk0
  2. P (Print list of parts)
  3. R (Recover)
  4. O (print current Hybrid MBR)
  5. H (chooses Hybrid)
  6. Partitions numbers to be hybridized: 2 3 4
  7. Y (Good for GRUB question)
  8. N (part 2 boot flag)
  9. N (part 3 boot flag)
  10. Y (part 4 boot flag make NTFS bootable partition)
  11. O (print current Hybrid MBR)
  12. W (Write the new MBR)
  13. Y (Yes! write the new MBR)
  14. Reboot


Here is sample Q&A for this section. Please notice the Press Enter/Return.


Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N): Y

Creating entry for GPT partition #2 (MBR partition #2)
Enter an MBR hex code (default AF): Press Enter/Return
Set the bootable flag? (Y/N): N

Creating entry for GPT partition #3 (MBR partition #3)
Enter an MBR hex code (default AB): Press Enter/Return
Set the bootable flag? (Y/N): N

Creating entry for GPT partition #4 (MBR partition #4)
Enter an MBR hex code (default 07): Press Enter/Return
Set the bootable flag? (Y/N): Y


50 replies
Question marked as Top-ranking reply

May 23, 2020 7:36 AM in response to rehman245

We need to create a MBR using GPT Fdisk. Let me post the steps in this reply shortly.


Rebuild MBR to match the new GPT information thus resetting the Hybrid MBR. Use defaults for other questions (like partition codes). The only values that need modifications are the Boot flags and step 10. Accept all other defaults that Gdisk offers. Please see the sample Q&A as an example. These steps can be repeated if you make a mistake before you get to Step 12, otherwise start from Step 1 for these steps. Step 6 has numbers which are typed with a space between the numbers. Please see the sample Q&A before you execute these steps.


  1. Sudo gdisk /dev/rdisk0
  2. P (Print list of parts)
  3. R (Recover)
  4. O (print current Hybrid MBR)
  5. H (chooses Hybrid)
  6. Partitions numbers to be hybridized: 2 3 4
  7. Y (Good for GRUB question)
  8. N (part 2 boot flag)
  9. N (part 3 boot flag)
  10. Y (part 4 boot flag make NTFS bootable partition)
  11. O (print current Hybrid MBR)
  12. W (Write the new MBR)
  13. Y (Yes! write the new MBR)
  14. Reboot


Here is sample Q&A for this section. Please notice the Press Enter/Return.


Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N): Y

Creating entry for GPT partition #2 (MBR partition #2)
Enter an MBR hex code (default AF): Press Enter/Return
Set the bootable flag? (Y/N): N

Creating entry for GPT partition #3 (MBR partition #3)
Enter an MBR hex code (default AB): Press Enter/Return
Set the bootable flag? (Y/N): N

Creating entry for GPT partition #4 (MBR partition #4)
Enter an MBR hex code (default 07): Press Enter/Return
Set the bootable flag? (Y/N): Y


May 16, 2020 8:06 AM in response to rehman245

We are going to destroy and recreate the GPT. This is your current GPT (based on your GDisk output) which you can verify.



If you get any errors in etc following steps, stop and post the error message(s).


The steps are


  • Destroy the current GPT
    • diskutil unmountDisk disk0
    • gpt destroy /dev/disk0
  • Create an empty GPT
    • gpt create /dev/disk0
  • Add GPT entries in sequence, and unmount as necessary.
  • EFI
    • gpt add -i 1 -b 40 -s 409600 -t efi /dev/disk0
    • diskutil unmountDisk disk0
  • macOS HFS+
    • gpt add -i 2 -b 409640 -s 236432232 -t hfs /dev/disk0
    • diskutil unmountDisk disk0
  • macOS Recovery (we need to use the explicit partition type GUID)
    • gpt add -i 3 -b 236841872 -s 1269536 -t 426F6F74-0000-11AA-AA11-00306543ECAC /dev/disk0
    • diskutil unmountDisk disk0
  • Bootcamp/Windows
    • gpt add -i 4 -b 293513216 -s 683591680 -t windows /dev/disk0
    • diskutil unmountDisk disk0
  • Post the output of
    • gpt -vv -r show /dev/disk0
    • diskutil list


May 22, 2020 6:54 AM in response to Loner T

done


Rehmans-MacBook-Pro:~ root# diskutil repairdisk disk0

Repairing the partition map might erase disk0s1, proceed? (y/N) y

Started partition map repair on disk0

Checking prerequisites

Checking the partition list

Adjusting partition map to fit whole disk as required

Checking for an EFI system partition

Checking the EFI system partition's size

Checking the EFI system partition's file system

Checking all HFS data partition loader spaces

Reviewing boot support loaders

Checking Core Storage Physical Volume partitions

Updating Windows boot.ini files as required

The partition map appears to be OK

Finished partition map repair on disk0

May 13, 2020 1:54 AM in response to Loner T

I dont see y command in the gdisk command list


Command (? for help): ?

b back up GPT data to a file

c change a partition's name

d delete a partition

i show detailed information on a partition

l list known partition types

n add a new partition

o create a new empty GUID partition table (GPT)

p print the partition table

q quit without saving changes

r recovery and transformation options (experts only)

s sort partitions

t change a partition's type code

v verify disk

w write table to disk and exit

x extra functionality (experts only)

? print this menu


And if I delete single partition using d 17 and then w command raise error below


Command (? for help): d 17

Partition number (1-18): 17


Command (? for help): w

Warning! Main partition table overlaps the first partition by 34 blocks!

You will need to delete this partition or resize it in another utility.

Aborting write of new partition table.

May 16, 2020 5:36 AM in response to Loner T

Hi Loner, below is the output for diskutil list, disk 1 is the USB drive with macOS

------------------------------------------------------------------------------------

Rehmans-MacBook-Pro:~ root# diskutil list

/dev/disk0

#: TYPE NAME SIZE IDENTIFIER

0: FDisk_partition_scheme *500.3 GB disk0

1: Windows_LDM 150.3 GB disk0s1

2: Windows_LDM 349.5 GB disk0s2

3: Windows_LDM 471.9 MB disk0s3

/dev/disk1

#: TYPE NAME SIZE IDENTIFIER

0: GUID_partition_scheme *32.1 GB disk1

1: EFI 209.7 MB disk1s1

2: Apple_HFS MacOs 31.2 GB disk1s2

3: Apple_Boot Recovery HD 650.0 MB disk1s3

/dev/disk5

#: TYPE NAME SIZE IDENTIFIER

0: Apple_partition_scheme *22.0 MB disk5

1: Apple_partition_map 32.3 KB disk5s1

2: Apple_HFS Mac Free Any Data Re... 22.0 MB disk5s2

/dev/disk6

#: TYPE NAME SIZE IDENTIFIER

0: GUID_partition_scheme *122.9 MB disk6

1: Apple_HFS Mac Any Data Recovery 122.8 MB disk6s1

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Mac OS partition type change to Windows_LDM during boot camp resize

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.