You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Accidentally Erased Partitions, Now have black screen with White Folder with ?

Hey everyone. I'm in quite the pickle here. I feel I may have accidentally done something really bad and need some help.


I have an older 2014 MacBook Air 13" with Big Sur. I wanted to try out Linux on it, since Apple is no longer releasing security updates for it, so I could continue using this laptop for years to come.


Long story short (because this part doesn't matter as much), I had to create some partitions in the drive, so that I could install Linux PoP OS. It had me create a Root, Swap, Home and Recovery partition. Most were smaller, in the 8-15GB range, with only 2 of them being larger. I also went into my Mac Disc Utilities and dragged the drive to create a 350GB partition (out of a total of 500GB), so that there was room for the Linux partition. Then I went through all the Linux instructions on how to create these partitions and it went perfectly. I did this about 2-3 weeks ago and have had ZERO problems using the Mac side or the Linux side by booting up and holding down Option to get to the Mac startup boot menu. I would select the drive I wante and voila, I'm in Mac or Linux.


Ok, now onto the beginning of the bad. One day, I'm using the Linux side and my old battery just shuts off the computer. It happens ALL the time and nothing bad has EVER happened because of it. It's the original battery and gets maybe 1.5-2 hrs of use before it will shut off. I usually plug in the laptop when it gets down to 30-40%. Ok, so it shuts off, no big deal, it's happened a million times before. But this time, when I go try and use Linux after booting into it, I get the dreaded "Oh No! Something has gone wrong" screen. It's bad news. So I'm on the Linux forums asking for help, nobody can help, nobody real knows why. And in the meantime, I'm like, what if I just delete the partitions I made for Linux using Disc Utility? So I go into Disc Utility and erase those partitions. And then it got even worse!


I NEVER touched the partition that had to deal with the Mac side of things. And yet, my Mac boots up into the black ? mark folder screen!?


So I boot into Recovery mode, thinking I'll just be able to use my Timemachine backup (I have lots of them on my external HD. I just did a Timemachine backup before I installed Linux and did all this partitioning stuff, JUST in case something like a worst case scenario happened. Like is happening right now)! And yet, it only has TWO choices for me?!?!? One backup is from 2016?!?! And the other is from March, 2024?!?! NEITHER choices are the backup I JUST made a few weeks ago!?! Ok, I'm freaking out at this point.


I read up more, I try to verify and repair the drives. There are at least 6 if not more drives showing. Here is a photo of what comes up when I open Disc Utility:


Then I did verify discs and repair discs to all of them, and it says they're "ALL GOOD". Restarted, and now, when booting into Recovery mode, I don't get anything!? I get another black screen, but this time with a globe and a triangle with an ! in the middle telling me to go to support.apple.com/mac/startup-1007F?


I am in a BIG pickle and need some help here. Not sure if anyone here can help? Or if this a case of me having to take it back to the Apple Store and have a Mac Genius fix it? This is freaking me out! ALL my music and playlists are on this drive and I can not loose it. Thank you

MacBook Air 13″, macOS 11.7

Posted on Sep 28, 2024 8:10 AM

Reply
Question marked as Top-ranking reply

Posted on Oct 15, 2024 7:19 PM

Thanks for the follow up and kind words. It is really nice to know that we were successful in resolving your issues. So many times we never know for sure.....having closure is really nice and refreshing.

30 replies

Oct 14, 2024 5:44 PM in response to SuperWookie68

Sorry about not getting back to you sooner. I thought I had already replied here, but I don't see my post.


Use the "Partition" tab within Disk Utility and delete those partitions. I believe you need to highlight a partition and click the " - " icon to delete a partition. Do that for each one of those former Linux partitions. Start with "disk0s3" and go in order to "disk0s7". I don't know if deleting them in this manner & order will allow them to automatically merge back into the APFS Container, but it is worth trying.


If not, then run the following command again so I can see the current drive layout after deleting those former Linux partitions (or attempted deletion) since I do have instructions for the command line to merge them (or the free space) back into the main macOS APFS Container:

diskutil  list  internal



Sep 29, 2024 8:09 PM in response to SuperWookie68

Continued....


Ok, so just to be crystal clear. At this point DO NOT click on the Reinstall macOS Big Sur button in the Recovery Mode? The second option of the four shown in this photo. Instead, run Disk Utility again? Verify Disks and Repair Disks?

Correct.


***Update***
Ok, I ran First Aid on all the drives. I first clicked on the little View box and Selected: Show All Devices. For some reason, it's not "showing" disk0s2 (which is the Mac partition, the 350GB part). It only shows:
Apple SSD SM0512G
NO NAME
disk0s4
disk0s5
disk0s6
disk0s7

If the Big Sur installer is still showing the drive layout like this, it is concerning.


Was Filevault enabled on macOS? That could explain why "disk0s2" is ghosted out and currently inaccessible.


Then below that, it shows Disk Images and says Apple disk image Media and macOS Base System.

Those are all the virtual volumes for & from the macOS installer. Just ignore them.


Anything else you need me to do?

Awaiting further instructions. Thank you

Yes, please while booted to the Big Sur installer (Command + Option + R) issue the following command within the Terminal app which is located on the Utilities menu on the menu bar:

diskutil  list  internal


This will provide me with the drive layout of the internal drive.


Was Filevault enabled?


Within Disk Utility, select "disk0s2" and see if you can click the "Mount" button. Does it prompt you to unlock the macOS volume "disk0s2"?


Perhaps try the following command in the Terminal app if Filevault was not enabled:

diskutil  mount  readOnly  disk0s2



Or if Filevault was enabled (use both of these):

diskutil  ap  unlockVolume  disk0s2  

diskutil  list  internal



This assumes that "disk0s2" is still there when you boot next time....these device designations can change with every boot...usually they will stay the same, but not always so you should always confirm the device identifier each time for these commands.


I'm interested in the output and the exact messages of the commands.

Sep 30, 2024 7:20 PM in response to SuperWookie68

I did a little research and I believe I may have a solution, but it is very tricky. I have personally never used the commands or tried the procedure, although I do understand the basic process.


First I want to see a different view of the internal drive layout. While booted to the Big Sur installer, please run the following command and show the output:

gpt  -r  show  /dev/disk0



Oct 4, 2024 2:18 PM in response to SuperWookie68

Looks very promising. I'm curious if you can see the macOS volume as a bootble option in the Startup Disk utility (may be on the Apple menu while booted into Recovery Mode). Otherwise just try to reboot the computer to see if it is able to boot into macOS now. If it has trouble, then try an Option Boot to see if the macOS volume appears as an option.


Oct 4, 2024 7:05 PM in response to SuperWookie68

SuperWookie68 wrote:

Hahahahahaha, this might have been the most fun I've ever had on a computer! It works! It's all back! You did it man!

I'm really glad it worked. And I'm glad you enjoyed the process.


I'm just glad I decided to glance at your post since many times I will skip a thread where a high level contributor is already responding (I've been very busy so I haven't had much time recently to really hang out here, but needed a distraction).


And you wanna know something EVEN MORE AMAZING??? I took this thing into the Apple store locally and they said: it can't be fixed. And yet you fixed it! UN REAL! Just absolutely amazing! You did it man! You did it!

Yeah, Apple doesn't train their front line agents for anything but basic support options. Erase & reinstall is their mantra. I cannot blame them sometimes, since that can be the easiest & fastest way forward since Apple is only concerned with macOS & the Apple hardware working properly...third party hardware & software is generally the responsibility of the user or the third party vendor.


I'm almost sad it's all over.

:-)


But one final question. All of the "discs": disk0s4, disk0s5, disk0s6, disk0s7 and NO NAME are all on my desktop now and I don't want to touch them until you tell me what to do with them, haha.

You can use Disk Utility to delete "disk0s3" to "disk0s7" in order. Do NOT touch "disk0s1" and of course "disk0s2" since those two are used by macOS.


I'm not sure whether Disk Utility will allow you to rejoin those deleted partitions back into your macOS APFS Container automatically or not. If not, then our adventure can continue a bit longer since I have some command line instructions readily available to make sure the space used by those partitions is reintegrated in the macOS APFS Container (I have provided these instructions for people who had botched Windows Bootcamp installations & removals although I'm not sure anyone bothered to follow up with confirmation of success...they worked for me in a test environment involving multiple partitions within a DMG file).


FYI, if you find that you still get an option to boot Linux, then that is another very easy fix since the Linux bootloader resides within a folder on the hidden EFI (aka ESP) partition. There is no automated Linux uninstaller or removal tool.


I'm going to do a Time Machine backup right now, before I do anything else.

Good thinking.


Can't thank you enough again man. Truly inspiring to know that there are people such as yourself, that are THIS knowledgeable AND willing to help others in their spare time. You must really enjoy problem solving as much as I do. This was quite the adventure my friend. Thank you

You're welcome. I'm glad to help and to pass on some of the knowledge I've gained over the years.


Actually this type of issue is one of the things I've done since the first computer I ever had back in the 80's. Between being curious about how data was stored on floppy disks (the 5 1/4" type) to modifying those floppy disks and performing data recovery very early on. And I do enjoy a good puzzle.


Many of the high level forum contributors here are extremely knowledgable. We all have our areas of expertise. I've learned a great deal from reading their posts on this forum even bookmarking some of them for later reference.


I would like to give a shout out to a respected forum contributor @Loner T who used to regularly respond to these types of posts to help users get their partitions back in order, unfortunately I haven't seen @Loner T post on here in several years. @Loner T had a lot more knowledge & experience with macOS and these things than I have at least regarding Apple partitions. I actually tried to find some of @Loner T's posts to guide me, but instead I stumbled across several posts on apple.stackexchange where some of this was explained (it was where I found those long UUID alpha-numeric sequences for the various partition types). I was able to find one post by @Loner T which confirmed that information so I combined information from both sources. I didn't bother looking any further since I thought I had a good handle on what was needed.


I hope you don't give up on your Linux experimentation either. A lot of my knowledge comes from using Linux for the last 20+ years. The best way to go with Linux is to either install to an external drive, or use just about any older computer (64bit CPU 2007+), or install into a Virtual Machine running on macOS if your computer has enough system resources. Partitioning & dual booting to a single drive is always risky, but mostly because people usually discover one or more partitions are too small. I dual booted early on when I was learning Linux by dual booting with Windows (actually triple booted one time) since booting to external drives at the time was not a good option with USB1 or even USB2. Windows was worse since it didn't know how to play nice with others.


Oct 15, 2024 4:58 PM in response to HWTech

Hey, no problem man! Just happy to have your help through all of this!


So I went into Disk Utility for each disk0s3-7 plus NO NAME and hit the minus button under the partition tab and voila, it looks like everything is back to normal. My total disk size went from 350 up to 500. And those disks are no longer on my desktop or showing up in Disk Utility.


Thank you SO MUCH once again. You know, most of the time, on the internet, I have no faith in anyone anymore. It's crazy how many people are rude, lazy and don't care in this world. But every once and awhile, you come across people such as yourself that make you realize: hey, there ARE still a few good people out there. And that feels really good to know that. I wish I could pay you back somehow or send you a virtual 6 pack, haha. But at the very least, please accept my words of Thanks for your help and sticking through this with me. It was a very cool process. Have a great rest of your week.


Best

Sep 28, 2024 8:31 PM in response to SuperWookie68

Continued.....


If booting into Internet Recovery Mode using Command + Option + R does not give you access to the Big Sur installer (it tell you which OS will be installed on the utilities screen when you successfully boot into Internet Recovery Mode). Unfortunately some Macs regardless of the special startup keys used will just boot to the online installer for the older version of macOS which originally shipped with the Mac from the factory. If this happens, then you will have two options:


Create a bootable macOS 10.13 to macOS 11.x USB installer using another compatible Mac. Do you have access to another working Mac which is able to use macOS 10.13 to 11.x (generally from Late-2009 to 2020/mid-2021)?


Or you will need to take the very long route and start by installing macOS 10.9 Mavericks to an external USB drive (hard drive or SSD). Once Mavericks is installed, then you can upgrade the OS on the external drive to macOS 10.11 El Capitan so that you can then access the Apple App Store where you can access the Big Sur installer so you can perform one file OS upgrade on the external drive (I would create a bootable Big Sur USB installer as well so you have more options). Once you have Big Sur installed on the external boot drive, you can boot to Big Sur to access the data on the internal SSD. You can also test your TM backup on the external boot drive to see if the TM backup is working (Mavericks was too old to work with a Big Sur TM backup).


Here is an Apple article with instructions for downloading & extracting various macOS installers:

How to download and install macOS - Apple Support


FYI, Even when you install Mavericks to an external drive, Mavericks will be too old to access the Internet to download the El Capitan installer, so you will need to use any other computer which can access the Internet (macOS, Windows, or even Linux) to download the El Capitan installer DMG file which you can transfer to the external boot drive so you can then install El Capitan. You will need to read the instructions carefully since there are multiple steps involved before you get to actually run the real "Install macOS El Capitan" app in the Applications folder.


If you still have your original internal Apple SSD, then you may be able to reinstall that SSD to in order to download & create a bootable macOS Big Sur USB installer assuming that SSD works & has a bootable OS on it. Just don't get the two SSDs mixed up.

Oct 4, 2024 3:54 PM in response to HWTech

DUDE!!!!!!!!!!!!!!!!!!!!! Hahahahaha....



Hahahahahaha, this might have been the most fun I've ever had on a computer! It works! It's all back! You did it man! And you wanna know something EVEN MORE AMAZING??? I took this thing into the Apple store locally and they said: it can't be fixed. And yet you fixed it! UN REAL! Just absolutely amazing! You did it man! You did it!




I'm almost sad it's all over.


But one final question. All of the "discs": disk0s4, disk0s5, disk0s6, disk0s7 and NO NAME are all on my desktop now and I don't want to touch them until you tell me what to do with them, haha. I'm going to do a Time Machine backup right now, before I do anything else. And I'll await your response.


Can't thank you enough again man. Truly inspiring to know that there are people such as yourself, that are THIS knowledgeable AND willing to help others in their spare time. You must really enjoy problem solving as much as I do. This was quite the adventure my friend. Thank you


Sep 28, 2024 12:17 PM in response to SuperWookie68

First, your screenshot is showing a very old version of Disk Utility (macOS 10.12 or earlier) so you have booted into a macOS installer for a very old version of macOS and not the installer for Big Sur. That is your main problem regarding fixing macOS & restoring your backups.


When the laptop powered off unexpectedly, there is a good chance it corrupted a file or the file system on your SSD. I would not expect it to do anything to macOS unless Linux was doing something like updating the bootloader perhaps because of a Linux Kernel update. With Linux, you should always be able to boot from the Linux installer to either attempt repairs, or to use the installer to jump into the OS on the internal SSD so that you can troubleshoot the Linux system while actually using that installation (you just bypass the bootloader by using the installer).


When troubleshooting issues, you should never make any major system changes. You need to carefully look for clues as you go through the normal boot troubleshooting steps for the respective OS. Making major changes such as deleting partitions will just complicate matters...usually resulting in the need to start completely over from scratch for both operating systems.


The picture of Disk Utility still shows multiple partitions which I'm assuming are still remnants from the Linux installation. It is hard to say for sure because the version of Disk Utility in that old macOS installer is too old to even recognize the drive layout & file systems used by later versions of macOS 10.13+ (macOS 10.15+ drive layout is even more complex).


The first step is to attempt to boot into Internet Recovery Mode using Command + Option + R to access the online macOS 11.x Big Sur installer. If you still see your macOS partition & installation, then use Disk Utility First Aid to scan whole physical SSD (checks the partition table) and also the hidden APFS Container (it will automatically scan all other APFS volumes within that Container). Within Disk Utility you will need to click "View" and select "Show All Devices" before the physical SSD and hidden Container appear on the left pane of Disk Utility. Even if First Aid summary says everything is "Ok", click "Show Details" and scroll through the report to see if any unfixed errors are listed. If there are errors, then run First Aid again until they are gone. If after several scans the errors remain, then you will need to erase the whole SSD to reinstall macOS.


It may also be interesting to check the health of the SSD even though the Apple SSDs do not really have much health information available. The easiest way to check the health of the SSD is by creating & using a bootable Knoppix Linux USB stick since it has the GSmartControl drive health monitoring app installed by default ("Start menu" --> System Tools --> GSmartControl). Within GSmartControl you can "View Output" or "Save Report" which should contain all the health information for the selected drive which I can review to see if the SSD had the problem.


Plus while booted to Knoppix, you can use it to get a better idea of the actual drive layout since it will be able to better identify all of the partitions on the SSD. Two command line options which provide slightly different views are:

lsblk  -f


May need to pre-pend "sudo " to that command, but I think the above is sufficient:

sudo  lsblk  -f


That command can make it easier to get the device identifier for the internal SSD needed for the next command where you replace "sdX" with the correct device identifier which will likely be either "sda" or "sdb"):

sudo  fdisk  -l  /dev/sdX


While booted to the macOS Big Sur installer you can use the following command which will produce less information since macOS knows nothing about Linux file systems:

diskutil  list  internal



Sep 28, 2024 8:30 PM in response to SuperWookie68

SuperWookie68 wrote:

So it's probably reverting all the way back to whatever OS came with this laptop. Maybe Mavericks or something like that. That's why the Disk Utility is so old.

I understand that since you mentioned you had Big Sur installed (or it seemed implied anyway). That is why I suggested using Command + Option + R to access Internet Recovery Mode to see if you can access the online Big Sur installer. Working with the newest installer will give us the best most reliable information about the system since older versions of macOS do not understand the new drive layouts or file systems used by later versions of macOS. Different key combinations are supposed to give access to different versions of the macOS installer. Unfortunately some Macs may only boot to the online installer for the older OS which originally shipped with the Mac from the factory.


The only drive or volume I can't do anything with is the second one from the top. The one that says disk0s2. It's greyed out and will not let me repair or verify it. It also will not let me Mount it for some reason? I clicked on get more info for the drive and this is what it says... and it's freaking me out! It says Capacity 350.29GB, and that was the size of my MacOS partition. Yet I NEVER erased that partition.

That is because you are using an old OS to examine a new style partition made with a newer OS which the old OS does not understand. That is why you need to boot into a later macOS installer (Big Sur is best, but any from macOS 10.13+ we can work with). macOS 10.13+ uses the newer style APFS Containers and file systems. An APFS Container is just a specialized type of Apple partition.


All those other volumes are not showing any names or listings which is why using a newer macOS installer & Knoppix Linux is necessary to get more information about them.


Then this is a part where you lose me: The first step is to attempt to boot into Internet Recovery Mode using Command + Option + R to access the online macOS 11.x Big Sur installer.

I don't want to install Big Sur ON TOP of anything. I want to restore everything back to normal.

I'm not asking you to reinstall anything at this point. The point of using Internet Recovery Mode is to attempt to access the Big Sur online installer so we can get more details about the drive layout and so you can run First Aid on the macOS boot volume which should be an APFS Container. We are at the information gathering stage here.


So my question is: will accessing and installing Big Sur in recovery mode install over all my stuff? If yes, then I'm not doing that. If no, than can you explain how this works?

If the missing macOS, presumably on partition "disk0s2", had Big Sur installed, then reinstalling Big Sur over top of itself will not hurt anything assuming the file system and SSD and laptop are all healthy. As long as you do not erase the drive or modify any partitions, then your data should be relatively safe.


How would installing a new Big Sur on top of whatever my drive contains allow me to recover my drive how it was 3 weeks ago? I'm not following here. Sorry, I'm not a computer expert.

If Big Sur was completely up to date, then reinstalling macOS over top of itself should not make any difference. If, however, Big Sur was not completely up to date, then reinstalling Big Sur would not leave it exactly as it was before although any update patches really should not cause any problems for most software & setups.



Sep 29, 2024 8:08 PM in response to SuperWookie68

SuperWookie68 wrote:

Ok, this is another part I just realized may or may not work. You mentioned this Knoppix program. And it "seems" to me like it's for running while in Linux? If that is the case, this will do nothing for me, as I don't have Linux on the laptop anymore.

Knoppix is just a self contained Linux boot disk on steroids. It is a highly customized Linux distribution with tons of utilities & apps installed by default and meant to run from a USB stick. It is basically a Swiss Army Knife since it can do lots of things. I have relied on it over the years as a troubleshooting tool since it can boot just about any Intel/AMD system out there. And it has utilities already installed which can be used for troubleshooting hardware. Many times Knoppix will boot a computer when its regular OS is unable to do so.


Plus, since you had Linux installed on this laptop it can tell us exactly what each partition is since Linux knows just about every partition type & file system out there unlike macOS which only knows itself (and sometimes not even that). Of course if you used Disk Utility to erase each of those former Linux partitions, then they are now just empty Apple partitions that are distracting us & getting in the way.


It has the dreaded "Oh No! Something has gone wrong" folder and screen. I could not figure out how to get my Linux system back. Everyone on the Linux forums were saying it would be way too hard to figure out EXACTLY what went wrong and to just start over.

Yes, it can be difficult....especially when assisting someone remotely since that remote assistance requires very precise information from the user asking for assistance. If that user is unable to provide the necessary information & details, then starting over is usually the best & easiest way.


If you were able to search online long enough, you would discover multiple methods for troubleshooting a Linux system that is unable to boot. In fact, I have done so multiple times over the years. It just takes a bit of persistence and lots of reading of online forum posts looking for clues. I've never asked any questions since I've usually been able to find the solution has already been posted long ago (or at least the bread crumbs needed to point me the correct direction). The hardest part is knowing what to search for, otherwise you just need to read a lot of forum posts until you can narrow down the search parameters a bit more. Usually the Linux distribution is immaterial since most of them work the same way, although there will be some distribution specific differences which can usually be easily adapted to another distribution with a few changes.


Dual booting with a single drive is always risky and not recommended unless you know what you are doing or are prepared to deal with issues as they arise...including starting completely over from scratch. Installing Linux to an external drive is the better safer option at least until you know what you are doing since it should not affect the internal drive. Or perhaps install Linux into a Virtual Machine depending on what you need from Linux. Even when people know what they are doing, partitioning a drive is rarely a good idea because sooner or later people realize one or more partitions are too small.


That is when I went into my Mac Drive in Disk Utility and erased the Linux partitions. So I can't get back into Linux on this laptop (as far as I know).

I assumed as much and was not planning on dealing with the former Linux installation. I just need to understand the current drive layout to be able to differentiate between the Apple parts & the former Linux parts. Unfortunately that may be very difficult if Disk Utility was used to erase all of the Linux partitions. All that did was destroy the data within those Linux partitions, but left all those partitions behind now as Apple partitions & file systems. It actually makes analyzing the drive much harder since all those partitions will now look like Apple partitions & file systems.


Oct 4, 2024 1:24 PM in response to SuperWookie68

It seems there was an error with the "add" command.


gpt  add  -i 2   -b  409640   -s  684158624   -t  7C3457EF-0000-11AA-AA11-00306543ECAC    /dev/disk0



It looks like you missed a hyphen "-" in that long value for the "-t" option between the "-AA11" & "0030654ECAC". There should be four hyphens in that log alpha-numeric value.


So, here are the commands you need to use now:


diskutil  unmountDisk  disk0

gpt  add  -i 2   -b  409640   -s  684158624   -t  7C3457EF-0000-11AA-AA11-00306543ECAC    /dev/disk0


gpt  -vv  -r  show  /dev/disk0

diskutil  list  internal

diskutil  verifyDisk  disk0

diskutil  verifyVolume  disk0s2


Good luck!

Oct 5, 2024 6:20 PM in response to SuperWookie68

SuperWookie68 wrote:

And if you have time and don't mind, I'd LOVE to hear the explanation about those command lines you had me type in. From the last set you sent me, that seemed to fix everything. I know I'll never truly understand it all, but would love to try and get the gist of it. What was each line of command doing? What was it affecting? That would be neat to learn HOW and WHY you had me type in all those commands. Just for my own curiosity. Again, I'll never understand it like you or other experts, but it would be fun to see your thought process and what exactly was going on with those commands.


These two commands are critical for knowing the current exact drive layout. The first one is simpler & easier to read so it provides a easy to understand layout at a quick glance. The second one is important because it provides more details, plus since we are using the "gpt" command to fix things, it is best to use that same command to get its interpretation of the drive layout. In addition we need some numbers related to the partition start location & size with one of the later "gpt" commands.

diskutil  list  internal

gpt  -r  show  /dev/disk0



The unmount command is needed since we cannot modify the partition information or file systems while a volume is mounted. This particular unmount command will unmount all volumes located on the specified drive. The "gpt" command here is removing the specified partition from the list of partitions. If you notice in the picture after this command when you ran "diskutil list internal" what used to be "disk0s2" partition then became "(free space)". The second unmount command is just to be safe since I saw it used in another post....it doesn't hurt anything, plus if macOS ended up remounting the volumes automatically this would definitely have been needed. I didn't have a system to test these commands to know for sure. Better safe than sorry.

diskutil  unmountDisk  disk0

gpt  remove  -i 2   /dev/disk0   

diskutil  unmountDisk  disk0



This is the command which ends up marking the "disk0s2" partition correctly. Technically there is no "disk0s2" partition at this point since we deleted it with the last "gpt remove" command. Technically we are taking what is shown as "(free space)" and turning it back into a partition again with the correct partition identifier. The long alpha-numeric value with the hyphens is a code to indicate an APFS partition/Container and that code is referred to as an UUID (aka Universally Unique IDentifier). The "-b" & "-s" values indicate the start location & size of the partition which we retrieve from the "gpt show" command earlier.

gpt  add  -i 2   -b  409640   -s  684158624   -t  7C3457EF-0000-11AA-AA11-00306543ECAC    /dev/disk0




This is meant to show the new current drive layout after making the changes so we can make sure we performed them correctly.

gpt  -vv  -r  show  /dev/disk0

diskutil  list  internal



These are just to be safe so we can confirm the partition layout (first command) and the APFS Container/file system are clean and are now accessible. Plus by using the command line here instead of the Disk Utility GUI I am able to make sure you are scanning the correct items and the output is more easily seen than in the Disk Utility GUI interface.

diskutil  verifyDisk  disk0

diskutil  verifyVolume  disk0s2



For reference, here is the forum post where I found the basic steps and it also provides some other information that can actually confirm the type of partition by reading the raw data at the beginning of the partition block (it was enough for me anyway):

https://apple.stackexchange.com/a/305712


To better understand any command line commands, you can use the "man" command to access the commands manual pages. For example, to get information about the "diskutil" and "gpt" commands:

man  diskutil

man  gpt


To understand the drive layout requires observations, looking at some command manuals like these, and even some trying to find information online to explain some of the layouts & structures.


So how DO I rejoin those partitions back into my macOS APFS container? It's still showing that my entire SSD is 350GB for Mac. And the other drives, while no longer on the desktop, are still in the Disk Utility app, but grayed out now.

Did you try to delete those listed partitions "disk0s3" to "disk0s7" using the Disk Utility GUI app? Theoretically if they are deleted they will either be merged back into the APFS Container "disk0s2" or will be listed as "(free space)". This is the easiest method to try first.


If this does not automatically merge all those partitions back into the APFS Container "disk0s2", then run the following command so I can see the current drive layout:

diskutil  list  internal






Accidentally Erased Partitions, Now have black screen with White Folder with ?

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