Does "gpt remove" command delete files along with partition? Trying to recover a Mac OS partition Vol Type FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF
Solution 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