0

I have a Macbook Pro with Big Sur on it, and I installed Linux Mint. I then resized the encrypted Mac OS APFS partition in order to grant Linux more space. After that I created another smaller Linux partition out of that new, smaller partition.

But now I've lost my "Macintosh HD" boot option in Boot Camp and can no longer boot into Mac OS, only Linux. And my Mac OS APFS partition now says it has a Startup Volume Type of "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF" (instead of the proper GUID).

My situation is almost identical to this question:

I followed the instructions provided in that answer, but when I got to the step to run the "gpt remove" command (gpt remove -i 2 disk0), I stopped, worried that it might delete my files on that Mac OS APFS partition along with the partition.

Some of the posts I've read with similar solutions (the link above, as well as https://discussions.apple.com/thread/251412540 and OS volume shows as type 'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFF' after attempting to delete some Linux partitions—cannot log in and How to fix broken GPT, GUID and unmountable, no type volumes?) all seem to suggest that they got their files back, but I just want to confirm that my files won't be deleted when I run the "gpt remove..." command.

Is this the case? Will gpt remove -i 2 disk0 delete my files when it removes that partition, or is it doing something slightly different (ie. removing partition info / header / metadata, etc)?

Hopefully this makes sense. I hope to be able to retain access to file files on that Mac OS APFS partition since it isn't backed up.

Please help!

1

The man page for the gpt clearly states the gpt remove command does the following.

Partitions are removed by clearing the partition type. No other information is changed.

In other words, the partition type is change to 00000000-0000-0000-0000-000000000000.

Although, a change in a partition type will also cause the 3 CRC32 values to change in 4 places in the GPT.

The “gpt remove” command does not delete files along with partition. In other words, the volume stored in the partition remains unchanged by the the command. Therefore, your files will not be deleted when your run the "gpt remove..." command. Entering gpt remove -i 2 disk0 will not delete your files when it removes that partition. The command does not removing any partition info / header / metadata, etc.

How the GPT Uses CRC32 Values

A 32 bit cyclic redundancy check (CRC32) computation is done by passing data through an algorithm that produces a 32 bit integer. The algorithm is designed to have a high probability of detecting any corruption that may exist in the data. This is accomplished by computing and storing the CRC32 value when the data can be assumed to be free of corruption. Later, if the data is run through the same algorithm and returns the same value, then the data is assumed to be error free.

The algorithm to compute CRC32 values for the GPT is the same as used by the command cksum -o 3. More information on this algorithm can be found in the man page for cksum. The man page can be viewed by entering the command given below.

man cksum

The GUID Partition Table (GPT) scheme consists of a header and table stored at the beginning and end of a drive. Each header contains offsets indicating where the other header resides. Therefore, both headers can not contain exactly the same values. On the other hand, the table stored at the beginning is exactly the same as the table stored at the end. After any desired changes are made to the GPT, new CRC32 values need to be computed for the tables and headers. Since the tables are identical, a new CRC32 value only needs to be computed for one table, however this value is stored in both headers. Since the headers are different, a new CRC32 value needs to be computed and stored for each header. Here, each header has a location to store its own CRC32 value. Therefore, 3 new CRC32 values are computed and used to update 2 places in each header for a total of 4 places.

References

GUID Partition Table
man gpt
man cksum

4
  • 1
    Thanks, David. What does it mean that the "partition type will also cause the 3 CRC32 values to change in 4 places in the GPT."? I have no clue what that means, sorry.
    – SH10151
    Jan 28 '21 at 1:03
  • Okay, thanks for the very technical explanation, but I'm at noob with this... Will this allow me to safely run the "gpt remove" command without losing the files in the partition? I'm guessing it will based on "Partitions are removed by clearing the partition type. No other information is changed."? Just not sure if "No other information" is 100% referring to the files in the partition and not some other things related to the partition (metadata, etc?). Sorry, I'm not very experienced with this.
    – SH10151
    Jan 28 '21 at 20:45
  • Will this allow me to safely run the "gpt remove" command without losing the files in the partition? The answer is yes. I'm guessing it will based on "Partitions are removed by clearing the partition type. No other information is changed."? Your guess is correct. Just not sure if "No other information" is 100% referring to the files in the partition and not some other things related to the partition (metadata, etc?). The command does not alter the space occupied by the partition. Jan 28 '21 at 23:49
  • Thank you, David, the further clarification was much appreciated. I was able to run the commands in the link above titled "macOS partition startup Volume type FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF" (with the "gpt" commands) and I was able to boot into Mac OS once again and all files were indeed there, as you said. Thanks again.
    – SH10151
    Jan 29 '21 at 0:15

You must log in to answer this question.

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