simillary to the someone else problem described here: Unable to boot Mac OS and disk utility unable to repair disk after bootcamp delete windows partition The laptop is: MacBook Pro 15” i9 2019 Last used system: macOS Big Sur Problem: I’m not able to repair and run Mac OS. On startup there is a folder icon with the question mark. I was able to enter the recovery mode but there is no startup disk that can be found. Here are the steps that I executed:

  1. In the Recovery mode (Don’t know why but was shown the recovery mode for macOS Mojave but I’ve updated it to macOS Big Sur more than 1 month ago) I’ve ran the repairVolume commnad for disk1 in terminal but waited for 16h to complete but didn’t so I’ve started to look for different solutions. The error says allways: and didn’t stop, just running over and over.
 Checking the container superblock,
error: nx_block_count is 122061322, while device block count is 103759765
  1. I decided to go step by step in this problem: But the commands and responses looked like this
[-bash-3.2# gpt remove -i 2 disk0
disk0s2 removed
[-bash-3.2# gpt -f add -i 2 -b 409640 -s 976695384 -t apfs disk0
gpt add: /dev/disk0: error: no space available on device

  1. As the previous error says that device block count is 103759765 and I cound’t use 976696384 so I’ve replaced it to 103759765 and ran again
gpt -f add -i 2 -b 409640 -s 103759765 -t apfs disk0

This time it works and response was that disk0 added

  1. Restarted the mac but still the same error (folder icon with question mark). But from this time when I’m opening Recovery panel (command + option + R) It’s shown as macOS Big Sur.

  2. In disk utility I don’t have First Aid option anymore and the disk0s2 is displayed as Not Mounted. When I click to Mount icon the error is shown: enter image description here

  3. output of diskutil list: enter image description here

  4. output of diskutil list /dev/disk0: enter image description here

  5. output of gpt -v -r show /dev/disk0: enter image description here

  6. output of fdisk /dev/disk0: enter image description here

  7. output of diskutil apfs list: enter image description here It seems that here might be the problem, but I don’t know how to fix it. *Previously before step 2 it shows simillary to this:

+-- Container ERROR -69808
|   ======================
|   APFS Container Reference:     disk1
|   Size (Capacity Ceiling):      ERROR -69620
|   Capacity In Use By Volumes:   ERROR -69620
|   Capacity Not Allocated:       ERROR -69620
|   |
|   +-< Physical Store disk0s2 F31C2BCB-9CEA-4449-9CAD-4893BBF532A5
|   |   -----------------------------------------------------------
|   |   APFS Physical Store Disk:   disk0s2
|   |   Size:                       372000141312 B (372.0 GB)
|   |
|   +-> No Volumes
  1. output of diskutil info /dev/disk0: enter image description here

  2. output of fsck_apfs -y /dev/disk0s2 enter image description here

I will be obligated if anyone can help with adding APFS container and running the system again!

  • 2
    If it were me, I would boot to recovery mode, erase the disk, reinstall and recover from backup.
    – Gilby
    Commented May 23, 2021 at 0:38

2 Answers 2


You were close. The correct commands are given below.

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

The question you gave as a link had a drive with a 512 byte sector size. Your drive has a 4096 byte sector size. The means your APFS container partition starts at sector 76806 instead of the value you choose of 409640. You can see this in the image you posted in step 8. Here you posted the output from the command gpt -v -r show /dev/disk0. In a typical macOS installation, there would be no free space between the two partitions.

Generally, running any application or command from a older version of macOS to repair a drive containing a newer version of macOS is not a good idea. On my 2018 Mac mini, I have Mojave and Big Sur installed in the same APFS container. When I run diskutil verifyVolume disk0s2 using Mojave and again using Big Sur, I get different results. Mojave incorrectly finds errors and Big Sur does not. Using Mojave to try repairing an APFS container with Big Sur installed could more damage than good. In your case, I do not know if any of your attempts at repair damaged the contents of the drive.

  • Thank you David Anderson for your help! That worked, but I’m still not able to run the system, somehow it turned back to macos Mojave. Positive fact is that I’ve been able to mount the Macintosh HD in Disk utility. But after running an First aid for the „Container disk2” I’m getting these informations in Details
    – mesz
    Commented May 23, 2021 at 18:30
  • The volume Macintosh HD was formatted by storagekitd (1677.81.1) and last modified by apfs_kext (1677.100.114). warning: apfs _sb at apfs_fs_index (4): apfs_features has unrecognized features (10) error: apfs_sb at apfs_fs_index (4): apfs_incompatibile_features has unsupported flags: (0x20) Volume superblock is invalid. The volume /dev/disk0s2 could not be verified completely. Operation successful. Unfortunatelly if I try to open a terminal in macOS utilities it shows „Recovery is trying to change system settings. No administrator was found”
    – mesz
    Commented May 23, 2021 at 18:34
  • As I stated in my answer, you should expect error messages when running Mojave First aid on a APFS container with Big Sur installed. Did you hold down the Option-Command-R key combination during startup in an attempt to boot Big Sur macOS Internet Recovery? Commented May 23, 2021 at 19:26
  • Thank you for the quick repsonse. Yes, you are right. If I use Option-Command-R key combinantion it’s opening the macOS BigSur Recovery but on the first screen the Recovery key is displayed and ask me to pass the: „Enter your recovery key to unlock the volume „Macintosh HD”” I’ve passed the correct one according to my SN of mac few times and didn’t work, so I’ve temporarly locked the user. I’ve tried also to use Command+S to run mac but after 13secs it does something in console mode then fan is started to run for another secound and automatically restarting.
    – mesz
    Commented May 23, 2021 at 20:56
  • Omg ignore me, I’ve been passing the wrong recovery key, I’ve reminded myself that I’ve set the fileVault and it should be the the code that was generated at this time... Running firstaid for disks on macos BigSur recovery
    – mesz
    Commented May 24, 2021 at 10:06

I suppose you have no valid data in this disk. In Recovery mode the terminal command will clean your disk and create an apfs container for a Mac Os X installation :

diskutil erasedisk apfs "Macintosh HD" gpt disk0
  • 1
    I have always felt posting an answer instructing the OP should give-up and start over is just stating the obvious. However, I am surprised how often that is the accepted answer. Commented May 23, 2021 at 5:24
  • @DavidAnderson - that's possibly because the number of people who actually know how to fix it from terminal can be counted on the fingers of one hand ;))
    – Tetsujin
    Commented May 23, 2021 at 6:57
  • 1
    @Tetsujin - I have accepted posts where later I discovered do to errors the answer could not have worked. I can only assume the OP did not implement my solution, but instead just gave-up and started over. Commented May 23, 2021 at 9:09

You must log in to answer this question.

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