2

My laptop messed up it’s macOS partition format when it tried to upgrade to Monterey yesterday. I deleted the GPT table so that I could rebuild it, but had to use fdisk to get rid of the “suspect mbr” issue that would not let me add a partition.

The issue now is that when I try to use gpt create -f /dev/disk2, it says that there is “no room for the PMBR”. I am stuck here since even trying to use the -f flag doesn’t solve it. I have a picture of GPT showing all of my partitions before I deleted the tables, but now I can not seem to recreate it.

Any help would be appreciated. The drive was used for Windows and macOS but honestly it is just the files on the APFS partition that I need back.

EDIT 1: Here is the result of fdisk /dev/disk1. I rebooted the computer that I am trying to recover with (booting from different drive) and disk2 became disk1 after the reboot. Same issue persists. enter image description here

3
  • Does fdisk even know what APFS is? Maybe see apple.stackexchange.com/questions/366792/…
    – Tetsujin
    Mar 17, 2022 at 17:44
  • MacBook1: Can you post the picture? Can you post the output from fdisk /dev/disk2? I also would suspect that disk2 is the wrong disk. Mar 17, 2022 at 18:23
  • @DavidAnderson I added the screenshot to my post. Disk2 was for sure the correct disk. I used fdisk in an attempt to create a new MBR to overwrite the troublesome one so that I could then delete it but this didn’t work out obviously. It was based on another forum post from years ago.
    – MacBook1
    Mar 18, 2022 at 7:32

1 Answer 1

0

One possible list of commands that could create your problem is given below.

diskutil unmountdisk disk1
gpt destroy /dev/disk1
fdisk -i -y -a hfs /dev/disk1

Entering the command

gpt create -f /dev/disk1

would then produce the following error message.

gpt create: disk1: error: no room for the PMBR

One possible fix would be to write zeros to the MBR. The command is given below.

dd if=/dev/zero count=1 of=/dev/disk1

Entering the command

fdisk /dev/disk1

would now produce the following output.

Disk: /dev/disk1    geometry: 60801/255/63 [976773168 sectors]
Signature: 0x0
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 2: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 3: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused      

You should now be able to enter the command given below.

gpt create -f /dev/disk1

Afterwards, entering the command

fdisk /dev/disk1

should produce the following output.

Disk: /dev/disk1    geometry: 60801/255/63 [976773168 sectors]
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE 1023 255  63 - 1023 255  63 [         1 -     976773167] <Unknown ID>        
 2: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 3: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused      

 

1
  • Spot on! Not only did you save my files but the machine is booting as usual. Thank you!
    – MacBook1
    Mar 18, 2022 at 20:49

You must log in to answer this question.

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