srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 1 | // parttypes.cc |
| 2 | // Class to manage partition type codes -- a slight variant on MBR type |
| 3 | // codes, GUID type codes, and associated names. |
| 4 | |
Rod Smith | 44cda47 | 2018-07-05 09:07:58 -0400 | [diff] [blame] | 5 | /* This program is copyright (c) 2009-2018 by Roderick W. Smith. It is distributed |
srs5694 | 221e087 | 2009-08-29 15:00:31 -0400 | [diff] [blame] | 6 | under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ |
| 7 | |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 8 | #define __STDC_LIMIT_MACROS |
| 9 | #define __STDC_CONSTANT_MACROS |
| 10 | |
| 11 | #include <string.h> |
| 12 | #include <stdint.h> |
| 13 | #include <stdio.h> |
srs5694 | fed16d0 | 2010-01-27 23:03:40 -0500 | [diff] [blame] | 14 | #include <iostream> |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 15 | #include "parttypes.h" |
| 16 | |
| 17 | using namespace std; |
| 18 | |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 19 | int PartType::numInstances = 0; |
| 20 | AType* PartType::allTypes = NULL; |
| 21 | AType* PartType::lastType = NULL; |
Gilles Moris | 94b1490 | 2019-05-15 07:07:21 +0200 | [diff] [blame] | 22 | const PartType PartType::unusedPartType = (GUIDData) "00000000-0000-0000-0000-000000000000"; |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 23 | |
Rod Smith | 34fc3ab | 2020-02-09 10:34:44 -0500 | [diff] [blame] | 24 | #define SCREEN_WIDTH 80 |
| 25 | #define NUM_COLUMNS 2 |
| 26 | #define DESC_LENGTH (SCREEN_WIDTH - (6 * NUM_COLUMNS)) / NUM_COLUMNS |
| 27 | |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 28 | // Constructor. Its main task is to initialize the data list, but only |
| 29 | // if this is the first instance, since it's a static linked list. |
| 30 | // Partition type codes are MBR type codes multiplied by 0x0100, with |
| 31 | // additional related codes taking on following numbers. For instance, |
| 32 | // the FreeBSD disklabel code in MBR is 0xa5; here, it's 0xa500, with |
| 33 | // additional FreeBSD codes being 0xa501, 0xa502, and so on. This gives |
| 34 | // related codes similar numbers and (given appropriate entry positions |
| 35 | // in the linked list) keeps them together in the listings generated |
| 36 | // by typing "L" at the main gdisk menu. |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 37 | PartType::PartType(void) : GUIDData() { |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 38 | numInstances++; |
| 39 | if (numInstances == 1) { |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 40 | AddAllTypes(); |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 41 | } // if |
| 42 | } // default constructor |
| 43 | |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 44 | PartType::PartType(const PartType & orig) : GUIDData(orig) { |
| 45 | numInstances++; |
| 46 | if (numInstances == 1) { // should never happen; just being paranoid |
| 47 | AddAllTypes(); |
| 48 | } // if |
| 49 | } // PartType copy constructor |
| 50 | |
| 51 | PartType::PartType(const GUIDData & orig) : GUIDData(orig) { |
| 52 | numInstances++; |
| 53 | if (numInstances == 1) { |
| 54 | AddAllTypes(); |
| 55 | } // if |
| 56 | } // PartType copy constructor |
| 57 | |
| 58 | PartType::~PartType(void) { |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 59 | AType* tempType; |
| 60 | |
| 61 | numInstances--; |
| 62 | if (numInstances == 0) { |
| 63 | while (allTypes != NULL) { |
| 64 | tempType = allTypes; |
| 65 | allTypes = allTypes->next; |
| 66 | delete tempType; |
| 67 | } // while |
| 68 | } // if |
| 69 | } // destructor |
| 70 | |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 71 | // Add all partition type codes to the internal linked-list structure. |
| 72 | // Used by constructors. |
srs5694 | 55d9261 | 2010-03-07 22:16:07 -0500 | [diff] [blame] | 73 | // See http://www.win.tue.nl/~aeb/partitions/partition_types-1.html |
| 74 | // for a list of MBR partition type codes. |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 75 | void PartType::AddAllTypes(void) { |
| 76 | // Start with the "unused entry," which should normally appear only |
| 77 | // on empty partition table entries.... |
| 78 | AddType(0x0000, "00000000-0000-0000-0000-000000000000", "Unused entry", 0); |
| 79 | |
srs5694 | d8eed46 | 2012-12-15 01:55:21 -0500 | [diff] [blame] | 80 | // DOS/Windows partition types, most of which are hidden from the "L" listing |
| 81 | // (they're available mainly for MBR-to-GPT conversions). |
srs5694 | 00b6d7a | 2011-06-26 22:40:06 -0400 | [diff] [blame] | 82 | AddType(0x0100, "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7", "Microsoft basic data", 0); // FAT-12 |
| 83 | AddType(0x0400, "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7", "Microsoft basic data", 0); // FAT-16 < 32M |
| 84 | AddType(0x0600, "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7", "Microsoft basic data", 0); // FAT-16 |
| 85 | AddType(0x0700, "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7", "Microsoft basic data", 1); // NTFS (or HPFS) |
Rod Smith | 79977a7 | 2021-03-10 19:42:31 -0500 | [diff] [blame] | 86 | AddType(0x0701, "558D43C5-A1AC-43C0-AAC8-D1472B2923D1", "Microsoft Storage Replica", 1); |
| 87 | AddType(0x0702, "90B6FF38-B98F-4358-A21F-48F35B4A8AD3", "ArcaOS Type 1", 1); |
srs5694 | 00b6d7a | 2011-06-26 22:40:06 -0400 | [diff] [blame] | 88 | AddType(0x0b00, "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7", "Microsoft basic data", 0); // FAT-32 |
| 89 | AddType(0x0c00, "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7", "Microsoft basic data", 0); // FAT-32 LBA |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 90 | AddType(0x0c01, "E3C9E316-0B5C-4DB8-817D-F92DF00215AE", "Microsoft reserved"); |
srs5694 | 00b6d7a | 2011-06-26 22:40:06 -0400 | [diff] [blame] | 91 | AddType(0x0e00, "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7", "Microsoft basic data", 0); // FAT-16 LBA |
| 92 | AddType(0x1100, "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7", "Microsoft basic data", 0); // Hidden FAT-12 |
| 93 | AddType(0x1400, "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7", "Microsoft basic data", 0); // Hidden FAT-16 < 32M |
| 94 | AddType(0x1600, "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7", "Microsoft basic data", 0); // Hidden FAT-16 |
| 95 | AddType(0x1700, "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7", "Microsoft basic data", 0); // Hidden NTFS (or HPFS) |
| 96 | AddType(0x1b00, "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7", "Microsoft basic data", 0); // Hidden FAT-32 |
| 97 | AddType(0x1c00, "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7", "Microsoft basic data", 0); // Hidden FAT-32 LBA |
| 98 | AddType(0x1e00, "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7", "Microsoft basic data", 0); // Hidden FAT-16 LBA |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 99 | AddType(0x2700, "DE94BBA4-06D1-4D40-A16A-BFD50179D6AC", "Windows RE"); |
Roderick W. Smith | 0fde58b | 2013-10-10 22:28:17 -0400 | [diff] [blame] | 100 | |
Roderick W. Smith | b784e0c | 2014-01-25 22:55:26 -0500 | [diff] [blame] | 101 | // Open Network Install Environment (ONIE) specific types. |
Roderick W. Smith | 5435fcf | 2014-02-17 12:01:51 -0500 | [diff] [blame] | 102 | // See http://www.onie.org/ and |
Rod Smith | 2a6daaf | 2017-07-25 12:53:52 -0400 | [diff] [blame] | 103 | // https://github.com/opencomputeproject/onie/blob/master/patches/gptfdisk/add-onie-partition-types.patch |
Roderick W. Smith | b784e0c | 2014-01-25 22:55:26 -0500 | [diff] [blame] | 104 | AddType(0x3000, "7412F7D5-A156-4B13-81DC-867174929325", "ONIE boot"); |
| 105 | AddType(0x3001, "D4E6E2CD-4469-46F3-B5CB-1BFF57AFC149", "ONIE config"); |
| 106 | |
Roderick W. Smith | a9630e3 | 2015-10-07 17:06:53 -0400 | [diff] [blame] | 107 | // Plan 9; see http://man.cat-v.org/9front/8/prep |
| 108 | AddType(0x3900, "C91818F9-8025-47AF-89D2-F030D7000C2C", "Plan 9"); |
| 109 | |
Roderick W. Smith | 0fde58b | 2013-10-10 22:28:17 -0400 | [diff] [blame] | 110 | // PowerPC reference platform boot partition |
| 111 | AddType(0x4100, "9E1A2D38-C612-4316-AA26-8B49521E5A8B", "PowerPC PReP boot"); |
| 112 | |
| 113 | // Windows LDM ("dynamic disk") types |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 114 | AddType(0x4200, "AF9B60A0-1431-4F62-BC68-3311714A69AD", "Windows LDM data"); // Logical disk manager |
| 115 | AddType(0x4201, "5808C8AA-7E8F-42E0-85D2-E1E90434CFB3", "Windows LDM metadata"); // Logical disk manager |
Roderick W. Smith | 54f8fb1 | 2015-03-17 19:46:05 -0400 | [diff] [blame] | 116 | AddType(0x4202, "E75CAF8F-F680-4CEE-AFA3-B001E56EFC2D", "Windows Storage Spaces"); // A newer LDM-type setup |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 117 | |
| 118 | // An oddball IBM filesystem.... |
| 119 | AddType(0x7501, "37AFFC90-EF7D-4E96-91C3-2D7AE055B174", "IBM GPFS"); // General Parallel File System (GPFS) |
| 120 | |
srs5694 | df9d363 | 2011-01-08 18:33:24 -0500 | [diff] [blame] | 121 | // ChromeOS-specific partition types... |
| 122 | // Values taken from vboot_reference/firmware/lib/cgptlib/include/gpt.h in |
| 123 | // ChromeOS source code, retrieved 12/23/2010. They're also at |
| 124 | // http://www.chromium.org/chromium-os/chromiumos-design-docs/disk-format. |
| 125 | // These have no MBR equivalents, AFAIK, so I'm using 0x7Fxx values, since they're close |
| 126 | // to the Linux values. |
| 127 | AddType(0x7f00, "FE3A2A5D-4F32-41A7-B725-ACCC3285A309", "ChromeOS kernel"); |
| 128 | AddType(0x7f01, "3CB8E202-3B7E-47DD-8A3C-7FF2A13CFCEC", "ChromeOS root"); |
| 129 | AddType(0x7f02, "2E0A753D-9E48-43B0-8337-B15192CB1B5E", "ChromeOS reserved"); |
Rod Smith | 075f3fe | 2022-04-12 19:00:23 -0400 | [diff] [blame] | 130 | AddType(0x7f03, "CAB6E88E-ABF3-4102-A07A-D4BB9BE3C1D3", "ChromeOS firmware"); |
| 131 | AddType(0x7f04, "09845860-705F-4BB5-B16C-8A8A099CAF52", "ChromeOS mini-OS"); |
| 132 | AddType(0x7f05, "3F0F8318-F146-4E6B-8222-C28C8F02E0D5", "ChromeOS hibernate"); |
srs5694 | df9d363 | 2011-01-08 18:33:24 -0500 | [diff] [blame] | 133 | |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 134 | // Linux-specific partition types.... |
srs5694 | d8eed46 | 2012-12-15 01:55:21 -0500 | [diff] [blame] | 135 | AddType(0x8200, "0657FD6D-A4AB-43C4-84E5-0933C84B4F4F", "Linux swap"); // Linux swap (or Solaris on MBR) |
srs5694 | 00b6d7a | 2011-06-26 22:40:06 -0400 | [diff] [blame] | 136 | AddType(0x8300, "0FC63DAF-8483-4772-8E79-3D69D8477DE4", "Linux filesystem"); // Linux native |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 137 | AddType(0x8301, "8DA63339-0007-60C0-C436-083AC8230908", "Linux reserved"); |
nl6720 | 7c7c854 | 2019-12-26 11:08:12 +0200 | [diff] [blame] | 138 | // See https://www.freedesktop.org/software/systemd/man/systemd-gpt-auto-generator.html |
| 139 | // and https://systemd.io/DISCOVERABLE_PARTITIONS |
Roderick W. Smith | 0fde58b | 2013-10-10 22:28:17 -0400 | [diff] [blame] | 140 | AddType(0x8302, "933AC7E1-2EB4-4F13-B844-0E14E2AEF915", "Linux /home"); // Linux /home (auto-mounted by systemd) |
Roderick W. Smith | 1a65132 | 2014-03-22 16:08:00 -0400 | [diff] [blame] | 141 | AddType(0x8303, "44479540-F297-41B2-9AF7-D131D5F0458A", "Linux x86 root (/)"); // Linux / on x86 (auto-mounted by systemd) |
| 142 | AddType(0x8304, "4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709", "Linux x86-64 root (/)"); // Linux / on x86-64 (auto-mounted by systemd) |
| 143 | AddType(0x8305, "B921B045-1DF0-41C3-AF44-4C6F280D3FAE", "Linux ARM64 root (/)"); // Linux / on 64-bit ARM (auto-mounted by systemd) |
| 144 | AddType(0x8306, "3B8F8425-20E0-4F3B-907F-1A25A76F98E8", "Linux /srv"); // Linux /srv (auto-mounted by systemd) |
Roderick W. Smith | 505a621 | 2015-06-19 08:59:36 -0400 | [diff] [blame] | 145 | AddType(0x8307, "69DAD710-2CE4-4E3C-B16C-21A1D49ABED3", "Linux ARM32 root (/)"); // Linux / on 32-bit ARM (auto-mounted by systemd) |
Rod Smith | 8dab6f2 | 2018-07-05 10:51:45 -0400 | [diff] [blame] | 146 | AddType(0x8308, "7FFEC5C9-2D00-49B7-8941-3EA10A5586B7", "Linux dm-crypt"); |
| 147 | AddType(0x8309, "CA7D7CCB-63ED-4C53-861C-1742536059CC", "Linux LUKS"); |
nl6720 | 7c7c854 | 2019-12-26 11:08:12 +0200 | [diff] [blame] | 148 | AddType(0x830A, "993D8D3D-F80E-4225-855A-9DAF8ED7EA97", "Linux IA-64 root (/)"); // Linux / on Itanium (auto-mounted by systemd) |
| 149 | AddType(0x830B, "D13C5D3B-B5D1-422A-B29F-9454FDC89D76", "Linux x86 root verity"); |
| 150 | AddType(0x830C, "2C7357ED-EBD2-46D9-AEC1-23D437EC2BF5", "Linux x86-64 root verity"); |
| 151 | AddType(0x830D, "7386CDF2-203C-47A9-A498-F2ECCE45A2D6", "Linux ARM32 root verity"); |
| 152 | AddType(0x830E, "DF3300CE-D69F-4C92-978C-9BFB0F38D820", "Linux ARM64 root verity"); |
| 153 | AddType(0x830F, "86ED10D5-B607-45BB-8957-D350F23D0571", "Linux IA-64 root verity"); |
| 154 | AddType(0x8310, "4D21B016-B534-45C2-A9FB-5C16E091FD2D", "Linux /var"); // Linux /var (auto-mounted by systemd) |
| 155 | AddType(0x8311, "7EC6F557-3BC5-4ACA-B293-16EF5DF639D1", "Linux /var/tmp"); // Linux /var/tmp (auto-mounted by systemd) |
Rod Smith | 6180deb | 2021-01-13 17:17:41 -0500 | [diff] [blame] | 156 | // https://systemd.io/HOME_DIRECTORY/ |
| 157 | AddType(0x8312, "773F91EF-66D4-49B5-BD83-D683BF40AD16", "Linux user's home"); // used by systemd-homed |
nl6720 | 78bc9d8 | 2020-09-25 09:51:32 +0300 | [diff] [blame] | 158 | AddType(0x8313, "75250D76-8CC6-458E-BD66-BD47CC81A812", "Linux x86 /usr "); // Linux /usr on x86 (auto-mounted by systemd) |
| 159 | AddType(0x8314, "8484680C-9521-48C6-9C11-B0720656F69E", "Linux x86-64 /usr"); // Linux /usr on x86-64 (auto-mounted by systemd) |
| 160 | AddType(0x8315, "7D0359A3-02B3-4F0A-865C-654403E70625", "Linux ARM32 /usr"); // Linux /usr on 32-bit ARM (auto-mounted by systemd) |
| 161 | AddType(0x8316, "B0E01050-EE5F-4390-949A-9101B17104E9", "Linux ARM64 /usr"); // Linux /usr on 64-bit ARM (auto-mounted by systemd) |
| 162 | AddType(0x8317, "4301D2A6-4E3B-4B2A-BB94-9E0B2C4225EA", "Linux IA-64 /usr"); // Linux /usr on Itanium (auto-mounted by systemd) |
| 163 | AddType(0x8318, "8F461B0D-14EE-4E81-9AA9-049B6FB97ABD", "Linux x86 /usr verity"); |
| 164 | AddType(0x8319, "77FF5F63-E7B6-4633-ACF4-1565B864C0E6", "Linux x86-64 /usr verity"); |
| 165 | AddType(0x831A, "C215D751-7BCD-4649-BE90-6627490A4C05", "Linux ARM32 /usr verity"); |
| 166 | AddType(0x831B, "6E11A4E7-FBCA-4DED-B9E9-E1A512BB664E", "Linux ARM64 /usr verity"); |
| 167 | AddType(0x831C, "6A491E03-3BE7-4545-8E38-83320E0EA880", "Linux IA-64 /usr verity"); |
Roderick W. Smith | 1eea9b0 | 2013-07-06 22:52:58 -0400 | [diff] [blame] | 168 | |
| 169 | // Used by Intel Rapid Start technology |
| 170 | AddType(0x8400, "D3BFE2DE-3DAF-11DF-BA40-E3A556D89593", "Intel Rapid Start"); |
Rod Smith | 79977a7 | 2021-03-10 19:42:31 -0500 | [diff] [blame] | 171 | // This is another Intel-associated technology, so I'm keeping it close to the previous one.... |
| 172 | AddType(0x8401, "7C5222BD-8F5D-4087-9C00-BF9843C7B58C", "SPDK block device"); |
Roderick W. Smith | 1eea9b0 | 2013-07-06 22:52:58 -0400 | [diff] [blame] | 173 | |
Rod Smith | e48d850 | 2020-02-13 17:48:29 -0500 | [diff] [blame] | 174 | // Type codes for Container Linux (formerly CoreOS; https://coreos.com) |
| 175 | AddType(0x8500, "5DFBF5F4-2848-4BAC-AA5E-0D9A20B745A6", "Container Linux /usr"); |
| 176 | AddType(0x8501, "3884DD41-8582-4404-B9A8-E9B84F2DF50E", "Container Linux resizable rootfs"); |
| 177 | AddType(0x8502, "C95DC21A-DF0E-4340-8D7B-26CBFA9A03E0", "Container Linux /OEM customizations"); |
| 178 | AddType(0x8503, "BE9067B9-EA49-4F15-B4F6-F36F8C9E1818", "Container Linux root on RAID"); |
| 179 | |
Roderick W. Smith | 1eea9b0 | 2013-07-06 22:52:58 -0400 | [diff] [blame] | 180 | // Another Linux type code.... |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 181 | AddType(0x8e00, "E6D6D379-F507-44C2-A23C-238F2A3DF928", "Linux LVM"); |
| 182 | |
Rod Smith | c554cf1 | 2016-10-19 16:38:00 -0400 | [diff] [blame] | 183 | // Android type codes.... |
Rod Smith | 45f012b | 2018-07-04 22:27:40 -0400 | [diff] [blame] | 184 | // from Wikipedia, https://gist.github.com/culots/704afd126dec2f45c22d0c9d42cb7fab, |
| 185 | // and my own Android devices' partition tables |
Rod Smith | c554cf1 | 2016-10-19 16:38:00 -0400 | [diff] [blame] | 186 | AddType(0xa000, "2568845D-2332-4675-BC39-8FA5A4748D15", "Android bootloader"); |
| 187 | AddType(0xa001, "114EAFFE-1552-4022-B26E-9B053604CF84", "Android bootloader 2"); |
Rod Smith | 44cda47 | 2018-07-05 09:07:58 -0400 | [diff] [blame] | 188 | AddType(0xa002, "49A4D17F-93A3-45C1-A0DE-F50B2EBE2599", "Android boot 1"); |
| 189 | AddType(0xa003, "4177C722-9E92-4AAB-8644-43502BFD5506", "Android recovery 1"); |
Rod Smith | c554cf1 | 2016-10-19 16:38:00 -0400 | [diff] [blame] | 190 | AddType(0xa004, "EF32A33B-A409-486C-9141-9FFB711F6266", "Android misc"); |
| 191 | AddType(0xa005, "20AC26BE-20B7-11E3-84C5-6CFDB94711E9", "Android metadata"); |
Rod Smith | 45f012b | 2018-07-04 22:27:40 -0400 | [diff] [blame] | 192 | AddType(0xa006, "38F428E6-D326-425D-9140-6E0EA133647C", "Android system 1"); |
Rod Smith | c554cf1 | 2016-10-19 16:38:00 -0400 | [diff] [blame] | 193 | AddType(0xa007, "A893EF21-E428-470A-9E55-0668FD91A2D9", "Android cache"); |
| 194 | AddType(0xa008, "DC76DDA9-5AC1-491C-AF42-A82591580C0D", "Android data"); |
| 195 | AddType(0xa009, "EBC597D0-2053-4B15-8B64-E0AAC75F4DB1", "Android persistent"); |
| 196 | AddType(0xa00a, "8F68CC74-C5E5-48DA-BE91-A0C8C15E9C80", "Android factory"); |
| 197 | AddType(0xa00b, "767941D0-2085-11E3-AD3B-6CFDB94711E9", "Android fastboot/tertiary"); |
| 198 | AddType(0xa00c, "AC6D7924-EB71-4DF8-B48D-E267B27148FF", "Android OEM"); |
Rod Smith | 45f012b | 2018-07-04 22:27:40 -0400 | [diff] [blame] | 199 | AddType(0xa00d, "C5A0AEEC-13EA-11E5-A1B1-001E67CA0C3C", "Android vendor"); |
| 200 | AddType(0xa00e, "BD59408B-4514-490D-BF12-9878D963F378", "Android config"); |
| 201 | AddType(0xa00f, "9FDAA6EF-4B3F-40D2-BA8D-BFF16BFB887B", "Android factory (alt)"); |
| 202 | AddType(0xa010, "19A710A2-B3CA-11E4-B026-10604B889DCF", "Android meta"); |
| 203 | AddType(0xa011, "193D1EA4-B3CA-11E4-B075-10604B889DCF", "Android EXT"); |
| 204 | AddType(0xa012, "DEA0BA2C-CBDD-4805-B4F9-F428251C3E98", "Android SBL1"); |
| 205 | AddType(0xa013, "8C6B52AD-8A9E-4398-AD09-AE916E53AE2D", "Android SBL2"); |
| 206 | AddType(0xa014, "05E044DF-92F1-4325-B69E-374A82E97D6E", "Android SBL3"); |
| 207 | AddType(0xa015, "400FFDCD-22E0-47E7-9A23-F16ED9382388", "Android APPSBL"); |
| 208 | AddType(0xa016, "A053AA7F-40B8-4B1C-BA08-2F68AC71A4F4", "Android QSEE/tz"); |
| 209 | AddType(0xa017, "E1A6A689-0C8D-4CC6-B4E8-55A4320FBD8A", "Android QHEE/hyp"); |
| 210 | AddType(0xa018, "098DF793-D712-413D-9D4E-89D711772228", "Android RPM"); |
| 211 | AddType(0xa019, "D4E0D938-B7FA-48C1-9D21-BC5ED5C4B203", "Android WDOG debug/sdi"); |
| 212 | AddType(0xa01a, "20A0C19C-286A-42FA-9CE7-F64C3226A794", "Android DDR"); |
| 213 | AddType(0xa01b, "A19F205F-CCD8-4B6D-8F1E-2D9BC24CFFB1", "Android CDT"); |
| 214 | AddType(0xa01c, "66C9B323-F7FC-48B6-BF96-6F32E335A428", "Android RAM dump"); |
| 215 | AddType(0xa01d, "303E6AC3-AF15-4C54-9E9B-D9A8FBECF401", "Android SEC"); |
| 216 | AddType(0xa01e, "C00EEF24-7709-43D6-9799-DD2B411E7A3C", "Android PMIC"); |
| 217 | AddType(0xa01f, "82ACC91F-357C-4A68-9C8F-689E1B1A23A1", "Android misc 1"); |
| 218 | AddType(0xa020, "E2802D54-0545-E8A1-A1E8-C7A3E245ACD4", "Android misc 2"); |
| 219 | AddType(0xa021, "65ADDCF4-0C5C-4D9A-AC2D-D90B5CBFCD03", "Android device info"); |
| 220 | AddType(0xa022, "E6E98DA2-E22A-4D12-AB33-169E7DEAA507", "Android APDP"); |
| 221 | AddType(0xa023, "ED9E8101-05FA-46B7-82AA-8D58770D200B", "Android MSADP"); |
| 222 | AddType(0xa024, "11406F35-1173-4869-807B-27DF71802812", "Android DPO"); |
Rod Smith | 44cda47 | 2018-07-05 09:07:58 -0400 | [diff] [blame] | 223 | AddType(0xa025, "9D72D4E4-9958-42DA-AC26-BEA7A90B0434", "Android recovery 2"); |
Rod Smith | 45f012b | 2018-07-04 22:27:40 -0400 | [diff] [blame] | 224 | AddType(0xa026, "6C95E238-E343-4BA8-B489-8681ED22AD0B", "Android persist"); |
| 225 | AddType(0xa027, "EBBEADAF-22C9-E33B-8F5D-0E81686A68CB", "Android modem ST1"); |
| 226 | AddType(0xa028, "0A288B1F-22C9-E33B-8F5D-0E81686A68CB", "Android modem ST2"); |
| 227 | AddType(0xa029, "57B90A16-22C9-E33B-8F5D-0E81686A68CB", "Android FSC"); |
| 228 | AddType(0xa02a, "638FF8E2-22C9-E33B-8F5D-0E81686A68CB", "Android FSG 1"); |
| 229 | AddType(0xa02b, "2013373E-1AC4-4131-BFD8-B6A7AC638772", "Android FSG 2"); |
| 230 | AddType(0xa02c, "2C86E742-745E-4FDD-BFD8-B6A7AC638772", "Android SSD"); |
| 231 | AddType(0xa02d, "DE7D4029-0F5B-41C8-AE7E-F6C023A02B33", "Android keystore"); |
| 232 | AddType(0xa02e, "323EF595-AF7A-4AFA-8060-97BE72841BB9", "Android encrypt"); |
| 233 | AddType(0xa02f, "45864011-CF89-46E6-A445-85262E065604", "Android EKSST"); |
| 234 | AddType(0xa030, "8ED8AE95-597F-4C8A-A5BD-A7FF8E4DFAA9", "Android RCT"); |
| 235 | AddType(0xa031, "DF24E5ED-8C96-4B86-B00B-79667DC6DE11", "Android spare1"); |
| 236 | AddType(0xa032, "7C29D3AD-78B9-452E-9DEB-D098D542F092", "Android spare2"); |
| 237 | AddType(0xa033, "379D107E-229E-499D-AD4F-61F5BCF87BD4", "Android spare3"); |
| 238 | AddType(0xa034, "0DEA65E5-A676-4CDF-823C-77568B577ED5", "Android spare4"); |
| 239 | AddType(0xa035, "4627AE27-CFEF-48A1-88FE-99C3509ADE26", "Android raw resources"); |
Rod Smith | 44cda47 | 2018-07-05 09:07:58 -0400 | [diff] [blame] | 240 | AddType(0xa036, "20117F86-E985-4357-B9EE-374BC1D8487D", "Android boot 2"); |
Rod Smith | 45f012b | 2018-07-04 22:27:40 -0400 | [diff] [blame] | 241 | AddType(0xa037, "86A7CB80-84E1-408C-99AB-694F1A410FC7", "Android FOTA"); |
| 242 | AddType(0xa038, "97D7B011-54DA-4835-B3C4-917AD6E73D74", "Android system 2"); |
| 243 | AddType(0xa039, "5594C694-C871-4B5F-90B1-690A6F68E0F7", "Android cache"); |
| 244 | AddType(0xa03a, "1B81E7E6-F50D-419B-A739-2AEEF8DA3335", "Android user data"); |
Rod Smith | 44cda47 | 2018-07-05 09:07:58 -0400 | [diff] [blame] | 245 | AddType(0xa03b, "98523EC6-90FE-4C67-B50A-0FC59ED6F56D", "LG (Android) advanced flasher"); |
Rod Smith | 45f012b | 2018-07-04 22:27:40 -0400 | [diff] [blame] | 246 | AddType(0xa03c, "2644BCC0-F36A-4792-9533-1738BED53EE3", "Android PG1FS"); |
| 247 | AddType(0xa03d, "DD7C91E9-38C9-45C5-8A12-4A80F7E14057", "Android PG2FS"); |
| 248 | AddType(0xa03e, "7696D5B6-43FD-4664-A228-C563C4A1E8CC", "Android board info"); |
| 249 | AddType(0xa03f, "0D802D54-058D-4A20-AD2D-C7A362CEACD4", "Android MFG"); |
| 250 | AddType(0xa040, "10A0C19C-516A-5444-5CE3-664C3226A794", "Android limits"); |
Rod Smith | c554cf1 | 2016-10-19 16:38:00 -0400 | [diff] [blame] | 251 | |
Rod Smith | 44cda47 | 2018-07-05 09:07:58 -0400 | [diff] [blame] | 252 | // Atari TOS partition type |
| 253 | AddType(0xa200, "734E5AFE-F61A-11E6-BC64-92361F002671", "Atari TOS basic data"); |
| 254 | |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 255 | // FreeBSD partition types.... |
| 256 | // Note: Rather than extract FreeBSD disklabel data, convert FreeBSD |
| 257 | // partitions in-place, and let FreeBSD sort out the details.... |
srs5694 | cb76c67 | 2010-02-11 22:22:22 -0500 | [diff] [blame] | 258 | AddType(0xa500, "516E7CB4-6ECF-11D6-8FF8-00022D09712B", "FreeBSD disklabel"); |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 259 | AddType(0xa501, "83BD6B9D-7F41-11DC-BE0B-001560B84F0F", "FreeBSD boot"); |
| 260 | AddType(0xa502, "516E7CB5-6ECF-11D6-8FF8-00022D09712B", "FreeBSD swap"); |
| 261 | AddType(0xa503, "516E7CB6-6ECF-11D6-8FF8-00022D09712B", "FreeBSD UFS"); |
| 262 | AddType(0xa504, "516E7CBA-6ECF-11D6-8FF8-00022D09712B", "FreeBSD ZFS"); |
| 263 | AddType(0xa505, "516E7CB8-6ECF-11D6-8FF8-00022D09712B", "FreeBSD Vinum/RAID"); |
Rod Smith | 075f3fe | 2022-04-12 19:00:23 -0400 | [diff] [blame] | 264 | AddType(0xa506, "74BA7DD9-A689-11E1-BD04-00E081286ACF", "FreeBSD nandfs"); |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 265 | |
srs5694 | fa3868e | 2012-03-28 01:45:57 -0400 | [diff] [blame] | 266 | // Midnight BSD partition types.... |
| 267 | AddType(0xa580, "85D5E45A-237C-11E1-B4B3-E89A8F7FC3A7", "Midnight BSD data"); |
| 268 | AddType(0xa581, "85D5E45E-237C-11E1-B4B3-E89A8F7FC3A7", "Midnight BSD boot"); |
| 269 | AddType(0xa582, "85D5E45B-237C-11E1-B4B3-E89A8F7FC3A7", "Midnight BSD swap"); |
| 270 | AddType(0xa583, "0394Ef8B-237E-11E1-B4B3-E89A8F7FC3A7", "Midnight BSD UFS"); |
| 271 | AddType(0xa584, "85D5E45D-237C-11E1-B4B3-E89A8F7FC3A7", "Midnight BSD ZFS"); |
| 272 | AddType(0xa585, "85D5E45C-237C-11E1-B4B3-E89A8F7FC3A7", "Midnight BSD Vinum"); |
| 273 | |
Roderick W. Smith | 54f8fb1 | 2015-03-17 19:46:05 -0400 | [diff] [blame] | 274 | // OpenBSD partition type.... |
Roderick W. Smith | a9630e3 | 2015-10-07 17:06:53 -0400 | [diff] [blame] | 275 | AddType(0xa600, "824CC7A0-36A8-11E3-890A-952519AD3F61", "OpenBSD disklabel"); |
Roderick W. Smith | 54f8fb1 | 2015-03-17 19:46:05 -0400 | [diff] [blame] | 276 | |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 277 | // A MacOS partition type, separated from others by NetBSD partition types... |
| 278 | AddType(0xa800, "55465300-0000-11AA-AA11-00306543ECAC", "Apple UFS"); // Mac OS X |
| 279 | |
| 280 | // NetBSD partition types. Note that the main entry sets it up as a |
| 281 | // FreeBSD disklabel. I'm not 100% certain this is the correct behavior. |
| 282 | AddType(0xa900, "516E7CB4-6ECF-11D6-8FF8-00022D09712B", "FreeBSD disklabel", 0); // NetBSD disklabel |
| 283 | AddType(0xa901, "49F48D32-B10E-11DC-B99B-0019D1879648", "NetBSD swap"); |
| 284 | AddType(0xa902, "49F48D5A-B10E-11DC-B99B-0019D1879648", "NetBSD FFS"); |
| 285 | AddType(0xa903, "49F48D82-B10E-11DC-B99B-0019D1879648", "NetBSD LFS"); |
| 286 | AddType(0xa904, "2DB519C4-B10F-11DC-B99B-0019D1879648", "NetBSD concatenated"); |
| 287 | AddType(0xa905, "2DB519EC-B10F-11DC-B99B-0019D1879648", "NetBSD encrypted"); |
| 288 | AddType(0xa906, "49F48DAA-B10E-11DC-B99B-0019D1879648", "NetBSD RAID"); |
| 289 | |
| 290 | // Mac OS partition types (See also 0xa800, above).... |
Roderick W. Smith | 0bb668e | 2015-10-08 09:56:50 -0400 | [diff] [blame] | 291 | AddType(0xab00, "426F6F74-0000-11AA-AA11-00306543ECAC", "Recovery HD"); |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 292 | AddType(0xaf00, "48465300-0000-11AA-AA11-00306543ECAC", "Apple HFS/HFS+"); |
| 293 | AddType(0xaf01, "52414944-0000-11AA-AA11-00306543ECAC", "Apple RAID"); |
| 294 | AddType(0xaf02, "52414944-5F4F-11AA-AA11-00306543ECAC", "Apple RAID offline"); |
| 295 | AddType(0xaf03, "4C616265-6C00-11AA-AA11-00306543ECAC", "Apple label"); |
| 296 | AddType(0xaf04, "5265636F-7665-11AA-AA11-00306543ECAC", "AppleTV recovery"); |
srs5694 | a17fe69 | 2011-09-10 20:30:20 -0400 | [diff] [blame] | 297 | AddType(0xaf05, "53746F72-6167-11AA-AA11-00306543ECAC", "Apple Core Storage"); |
Rod Smith | 2a6daaf | 2017-07-25 12:53:52 -0400 | [diff] [blame] | 298 | AddType(0xaf06, "B6FA30DA-92D2-4A9A-96F1-871EC6486200", "Apple SoftRAID Status"); |
| 299 | AddType(0xaf07, "2E313465-19B9-463F-8126-8A7993773801", "Apple SoftRAID Scratch"); |
| 300 | AddType(0xaf08, "FA709C7E-65B1-4593-BFD5-E71D61DE9B02", "Apple SoftRAID Volume"); |
| 301 | AddType(0xaf09, "BBBA6DF5-F46F-4A89-8F59-8765B2727503", "Apple SoftRAID Cache"); |
Rod Smith | 643126a | 2017-10-03 11:32:12 -0400 | [diff] [blame] | 302 | AddType(0xaf0a, "7C3457EF-0000-11AA-AA11-00306543ECAC", "Apple APFS"); |
Rod Smith | 075f3fe | 2022-04-12 19:00:23 -0400 | [diff] [blame] | 303 | AddType(0xaf0b, "69646961-6700-11AA-AA11-00306543ECAC", "Apple APFS Pre-Boot"); |
| 304 | AddType(0xaf0c, "52637672-7900-11AA-AA11-00306543ECAC", "Apple APFS Recovery"); |
| 305 | |
| 306 | // U-Boot boot loader; see https://lists.denx.de/pipermail/u-boot/2020-November/432928.html |
| 307 | // and https://source.denx.de/u-boot/u-boot/-/blob/v2021.07/include/part_efi.h#L59-61 |
| 308 | AddType(0xb000, "3DE21764-95BD-54BD-A5C3-4ABE786F38A8", "U-Boot boot loader"); |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 309 | |
Rod Smith | c554cf1 | 2016-10-19 16:38:00 -0400 | [diff] [blame] | 310 | // QNX Power-Safe (QNX6) |
| 311 | AddType(0xb300, "CEF5A9AD-73BC-4601-89F3-CDEEEEE321A1", "QNX6 Power-Safe"); |
| 312 | |
Rod Smith | 236f26b | 2021-06-09 09:57:33 -0400 | [diff] [blame] | 313 | // Barebox boot loader; see https://barebox.org/doc/latest/user/state.html?highlight=guid#sd-emmc-and-ata |
| 314 | AddType(0xbb00, "4778ED65-BF42-45FA-9C5B-287A1DC4AAB1", "Barebox boot loader"); |
| 315 | |
Roderick W. Smith | a9630e3 | 2015-10-07 17:06:53 -0400 | [diff] [blame] | 316 | // Acronis Secure Zone |
| 317 | AddType(0xbc00, "0311FC50-01CA-4725-AD77-9ADBB20ACE98", "Acronis Secure Zone"); |
| 318 | |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 319 | // Solaris partition types (one of which is shared with MacOS) |
| 320 | AddType(0xbe00, "6A82CB45-1DD2-11B2-99A6-080020736631", "Solaris boot"); |
| 321 | AddType(0xbf00, "6A85CF4D-1DD2-11B2-99A6-080020736631", "Solaris root"); |
| 322 | AddType(0xbf01, "6A898CC3-1DD2-11B2-99A6-080020736631", "Solaris /usr & Mac ZFS"); // Solaris/MacOS |
| 323 | AddType(0xbf02, "6A87C46F-1DD2-11B2-99A6-080020736631", "Solaris swap"); |
| 324 | AddType(0xbf03, "6A8B642B-1DD2-11B2-99A6-080020736631", "Solaris backup"); |
| 325 | AddType(0xbf04, "6A8EF2E9-1DD2-11B2-99A6-080020736631", "Solaris /var"); |
| 326 | AddType(0xbf05, "6A90BA39-1DD2-11B2-99A6-080020736631", "Solaris /home"); |
| 327 | AddType(0xbf06, "6A9283A5-1DD2-11B2-99A6-080020736631", "Solaris alternate sector"); |
| 328 | AddType(0xbf07, "6A945A3B-1DD2-11B2-99A6-080020736631", "Solaris Reserved 1"); |
| 329 | AddType(0xbf08, "6A9630D1-1DD2-11B2-99A6-080020736631", "Solaris Reserved 2"); |
| 330 | AddType(0xbf09, "6A980767-1DD2-11B2-99A6-080020736631", "Solaris Reserved 3"); |
| 331 | AddType(0xbf0a, "6A96237F-1DD2-11B2-99A6-080020736631", "Solaris Reserved 4"); |
| 332 | AddType(0xbf0b, "6A8D2AC7-1DD2-11B2-99A6-080020736631", "Solaris Reserved 5"); |
| 333 | |
| 334 | // I can find no MBR equivalents for these, but they're on the |
| 335 | // Wikipedia page for GPT, so here we go.... |
| 336 | AddType(0xc001, "75894C1E-3AEB-11D3-B7C1-7B03A0000000", "HP-UX data"); |
| 337 | AddType(0xc002, "E2A1E728-32E3-11D6-A682-7B03A0000000", "HP-UX service"); |
| 338 | |
Rod Smith | c554cf1 | 2016-10-19 16:38:00 -0400 | [diff] [blame] | 339 | // Open Network Install Environment (ONIE) partitions.... |
| 340 | AddType(0xe100, "7412F7D5-A156-4B13-81DC-867174929325", "ONIE boot"); |
| 341 | AddType(0xe101, "D4E6E2CD-4469-46F3-B5CB-1BFF57AFC149", "ONIE config"); |
| 342 | |
Rod Smith | e48d850 | 2020-02-13 17:48:29 -0500 | [diff] [blame] | 343 | // Veracrypt (https://www.veracrypt.fr/en/Home.html) encrypted partition |
| 344 | AddType(0xe900, "8C8F8EFF-AC95-4770-814A-21994F2DBC8F", "Veracrypt data"); |
| 345 | |
nl6720 | db5727e | 2020-04-11 09:56:29 +0300 | [diff] [blame] | 346 | // See https://systemd.io/BOOT_LOADER_SPECIFICATION/ |
| 347 | AddType(0xea00, "BC13C2FF-59E6-4262-A352-B275FD6F7172", "XBOOTLDR partition"); |
Roderick W. Smith | 1eea9b0 | 2013-07-06 22:52:58 -0400 | [diff] [blame] | 348 | |
srs5694 | df231c1 | 2013-01-09 14:50:30 -0500 | [diff] [blame] | 349 | // Type code for Haiku; uses BeOS MBR code as hex code base |
| 350 | AddType(0xeb00, "42465331-3BA3-10F1-802A-4861696B7521", "Haiku BFS"); |
| 351 | |
Roderick W. Smith | b784e0c | 2014-01-25 22:55:26 -0500 | [diff] [blame] | 352 | // Manufacturer-specific ESP-like partitions (in order in which they were added) |
srs5694 | d8eed46 | 2012-12-15 01:55:21 -0500 | [diff] [blame] | 353 | AddType(0xed00, "F4019732-066E-4E12-8273-346C5641494F", "Sony system partition"); |
Roderick W. Smith | b784e0c | 2014-01-25 22:55:26 -0500 | [diff] [blame] | 354 | AddType(0xed01, "BFBFAFE7-A34F-448A-9A5B-6213EB736C22", "Lenovo system partition"); |
srs5694 | d8eed46 | 2012-12-15 01:55:21 -0500 | [diff] [blame] | 355 | |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 356 | // EFI system and related partitions |
nl6720 | 4cd84de | 2018-07-10 11:52:02 +0300 | [diff] [blame] | 357 | AddType(0xef00, "C12A7328-F81F-11D2-BA4B-00A0C93EC93B", "EFI system partition"); // Parted identifies these as having the "boot flag" set |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 358 | AddType(0xef01, "024DEE41-33E7-11D3-9D69-0008C781F39F", "MBR partition scheme"); // Used to nest MBR in GPT |
srs5694 | d8eed46 | 2012-12-15 01:55:21 -0500 | [diff] [blame] | 359 | AddType(0xef02, "21686148-6449-6E6F-744E-656564454649", "BIOS boot partition"); // Used by GRUB |
| 360 | |
Rod Smith | 1d46f37 | 2022-04-14 20:01:30 -0400 | [diff] [blame] | 361 | // Fuscia OS codes; see https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/system/public/zircon/hw/gpt.h |
Rod Smith | 075f3fe | 2022-04-12 19:00:23 -0400 | [diff] [blame] | 362 | AddType(0xf100, "FE8A2634-5E2E-46BA-99E3-3A192091A350", "Fuchsia boot loader (slot A/B/R)"); |
| 363 | AddType(0xf101, "D9FD4535-106C-4CEC-8D37-DFC020CA87CB", "Fuchsia durable mutable encrypted system data"); |
| 364 | AddType(0xf102, "A409E16B-78AA-4ACC-995C-302352621A41", "Fuchsia durable mutable boot loader"); |
| 365 | AddType(0xf103, "F95D940E-CABA-4578-9B93-BB6C90F29D3E", "Fuchsia factory ro system data"); |
| 366 | AddType(0xf104, "10B8DBAA-D2BF-42A9-98C6-A7C5DB3701E7", "Fuchsia factory ro bootloader data"); |
| 367 | AddType(0xf105, "49FD7CB8-DF15-4E73-B9D9-992070127F0F", "Fuchsia Volume Manager"); |
| 368 | AddType(0xf106, "421A8BFC-85D9-4D85-ACDA-B64EEC0133E9", "Fuchsia verified boot metadata (slot A/B/R)"); |
| 369 | AddType(0xf107, "9B37FFF6-2E58-466A-983A-F7926D0B04E0", "Fuchsia Zircon boot image (slot A/B/R)"); |
| 370 | AddType(0xf108, "C12A7328-F81F-11D2-BA4B-00A0C93EC93B", "Fuchsia ESP"); |
| 371 | AddType(0xf109, "606B000B-B7C7-4653-A7D5-B737332C899D", "Fuchsia System"); |
| 372 | AddType(0xf10a, "08185F0C-892D-428A-A789-DBEEC8F55E6A", "Fuchsia Data"); |
| 373 | AddType(0xf10b, "48435546-4953-2041-494E-5354414C4C52", "Fuchsia Install"); |
| 374 | AddType(0xf10c, "2967380E-134C-4CBB-B6DA-17E7CE1CA45D", "Fuchsia Blob"); |
| 375 | AddType(0xf10d, "41D0E340-57E3-954E-8C1E-17ECAC44CFF5", "Fuchsia FVM"); |
| 376 | AddType(0xf10e, "DE30CC86-1F4A-4A31-93C4-66F147D33E05", "Fuchsia Zircon boot image (slot A)"); |
| 377 | AddType(0xf10f, "23CC04DF-C278-4CE7-8471-897D1A4BCDF7", "Fuchsia Zircon boot image (slot B)"); |
| 378 | AddType(0xf110, "A0E5CF57-2DEF-46BE-A80C-A2067C37CD49", "Fuchsia Zircon boot image (slot R)"); |
| 379 | AddType(0xf111, "4E5E989E-4C86-11E8-A15B-480FCF35F8E6", "Fuchsia sys-config"); |
| 380 | AddType(0xf112, "5A3A90BE-4C86-11E8-A15B-480FCF35F8E6", "Fuchsia factory-config"); |
| 381 | AddType(0xf113, "5ECE94FE-4C86-11E8-A15B-480FCF35F8E6", "Fuchsia bootloader"); |
| 382 | AddType(0xf114, "8B94D043-30BE-4871-9DFA-D69556E8C1F3", "Fuchsia guid-test"); |
| 383 | AddType(0xf115, "A13B4D9A-EC5F-11E8-97D8-6C3BE52705BF", "Fuchsia verified boot metadata (A)"); |
| 384 | AddType(0xf116, "A288ABF2-EC5F-11E8-97D8-6C3BE52705BF", "Fuchsia verified boot metadata (B)"); |
| 385 | AddType(0xf117, "6A2460C3-CD11-4E8B-80A8-12CCE268ED0A", "Fuchsia verified boot metadata (R)"); |
| 386 | AddType(0xf118, "1D75395D-F2C6-476B-A8B7-45CC1C97B476", "Fuchsia misc"); |
| 387 | AddType(0xf119, "900B0FC5-90CD-4D4F-84F9-9F8ED579DB88", "Fuchsia emmc-boot1"); |
| 388 | AddType(0xf11a, "B2B2E8D1-7C10-4EBC-A2D0-4614568260AD", "Fuchsia emmc-boot2"); |
| 389 | |
Roderick W. Smith | 1a65132 | 2014-03-22 16:08:00 -0400 | [diff] [blame] | 390 | // Ceph type codes; see https://github.com/ceph/ceph/blob/9bcc42a3e6b08521694b5c0228b2c6ed7b3d312e/src/ceph-disk#L76-L81 |
Rod Smith | 8dab6f2 | 2018-07-05 10:51:45 -0400 | [diff] [blame] | 391 | // and Wikipedia |
Roderick W. Smith | 1a65132 | 2014-03-22 16:08:00 -0400 | [diff] [blame] | 392 | AddType(0xf800, "4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D", "Ceph OSD"); // Ceph Object Storage Daemon |
| 393 | AddType(0xf801, "4FBD7E29-9D25-41B8-AFD0-5EC00CEFF05D", "Ceph dm-crypt OSD"); // Ceph Object Storage Daemon (encrypted) |
Roderick W. Smith | 54f8fb1 | 2015-03-17 19:46:05 -0400 | [diff] [blame] | 394 | AddType(0xf802, "45B0969E-9B03-4F30-B4C6-B4B80CEFF106", "Ceph journal"); |
Roderick W. Smith | 1a65132 | 2014-03-22 16:08:00 -0400 | [diff] [blame] | 395 | AddType(0xf803, "45B0969E-9B03-4F30-B4C6-5EC00CEFF106", "Ceph dm-crypt journal"); |
| 396 | AddType(0xf804, "89C57F98-2FE5-4DC0-89C1-F3AD0CEFF2BE", "Ceph disk in creation"); |
| 397 | AddType(0xf805, "89C57F98-2FE5-4DC0-89C1-5EC00CEFF2BE", "Ceph dm-crypt disk in creation"); |
Rod Smith | 8dab6f2 | 2018-07-05 10:51:45 -0400 | [diff] [blame] | 398 | AddType(0xf806, "CAFECAFE-9B03-4F30-B4C6-B4B80CEFF106", "Ceph block"); |
| 399 | AddType(0xf807, "30CD0809-C2B2-499C-8879-2D6B78529876", "Ceph block DB"); |
| 400 | AddType(0xf808, "5CE17FCE-4087-4169-B7FF-056CC58473F9", "Ceph block write-ahead log"); |
| 401 | AddType(0xf809, "FB3AABF9-D25F-47CC-BF5E-721D1816496B", "Ceph lockbox for dm-crypt keys"); |
| 402 | AddType(0xf80a, "4FBD7E29-8AE0-4982-BF9D-5A8D867AF560", "Ceph multipath OSD"); |
| 403 | AddType(0xf80b, "45B0969E-8AE0-4982-BF9D-5A8D867AF560", "Ceph multipath journal"); |
| 404 | AddType(0xf80c, "CAFECAFE-8AE0-4982-BF9D-5A8D867AF560", "Ceph multipath block 1"); |
| 405 | AddType(0xf80d, "7F4A666A-16F3-47A2-8445-152EF4D03F6C", "Ceph multipath block 2"); |
| 406 | AddType(0xf80e, "EC6D6385-E346-45DC-BE91-DA2A7C8B3261", "Ceph multipath block DB"); |
| 407 | AddType(0xf80f, "01B41E1B-002A-453C-9F17-88793989FF8F", "Ceph multipath block write-ahead log"); |
| 408 | AddType(0xf810, "CAFECAFE-9B03-4F30-B4C6-5EC00CEFF106", "Ceph dm-crypt block"); |
| 409 | AddType(0xf811, "93B0052D-02D9-4D8A-A43B-33A3EE4DFBC3", "Ceph dm-crypt block DB"); |
| 410 | AddType(0xf812, "306E8683-4FE2-4330-B7C0-00A917C16966", "Ceph dm-crypt block write-ahead log"); |
| 411 | AddType(0xf813, "45B0969E-9B03-4F30-B4C6-35865CEFF106", "Ceph dm-crypt LUKS journal"); |
| 412 | AddType(0xf814, "CAFECAFE-9B03-4F30-B4C6-35865CEFF106", "Ceph dm-crypt LUKS block"); |
| 413 | AddType(0xf815, "166418DA-C469-4022-ADF4-B30AFD37F176", "Ceph dm-crypt LUKS block DB"); |
| 414 | AddType(0xf816, "86A32090-3647-40B9-BBBD-38D8C573AA86", "Ceph dm-crypt LUKS block write-ahead log"); |
| 415 | AddType(0xf817, "4FBD7E29-9D25-41B8-AFD0-35865CEFF05D", "Ceph dm-crypt LUKS OSD"); |
Roderick W. Smith | 1a65132 | 2014-03-22 16:08:00 -0400 | [diff] [blame] | 416 | |
srs5694 | d8eed46 | 2012-12-15 01:55:21 -0500 | [diff] [blame] | 417 | // VMWare ESX partition types codes |
| 418 | AddType(0xfb00, "AA31E02A-400F-11DB-9590-000C2911D1B8", "VMWare VMFS"); |
| 419 | AddType(0xfb01, "9198EFFC-31C0-11DB-8F78-000C2911D1B8", "VMWare reserved"); |
| 420 | AddType(0xfc00, "9D275380-40AD-11DB-BF97-000C2911D1B8", "VMWare kcore crash protection"); |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 421 | |
| 422 | // A straggler Linux partition type.... |
| 423 | AddType(0xfd00, "A19D880F-05FC-4D3B-A006-743F0F84911E", "Linux RAID"); |
| 424 | |
| 425 | // Note: DO NOT use the 0xffff code; that's reserved to indicate an |
srs5694 | 55d9261 | 2010-03-07 22:16:07 -0500 | [diff] [blame] | 426 | // unknown GUID type code. |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 427 | } // PartType::AddAllTypes() |
| 428 | |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 429 | // Add a single type to the linked list of types. Returns 1 if operation |
srs5694 | e321d44 | 2010-01-29 17:44:04 -0500 | [diff] [blame] | 430 | // succeeds, 0 otherwise. |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 431 | int PartType::AddType(uint16_t mbrType, const char * guidData, const char * name, |
| 432 | int toDisplay) { |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 433 | AType* tempType; |
| 434 | int allOK = 1; |
| 435 | |
| 436 | tempType = new AType; |
| 437 | if (tempType != NULL) { |
| 438 | tempType->MBRType = mbrType; |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 439 | tempType->GUIDType = guidData; |
| 440 | tempType->name = name; |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 441 | tempType->display = toDisplay; |
| 442 | tempType->next = NULL; |
| 443 | if (allTypes == NULL) { // first entry |
| 444 | allTypes = tempType; |
| 445 | } else { |
| 446 | lastType->next = tempType; |
| 447 | } // if/else |
| 448 | lastType = tempType; |
| 449 | } else { |
srs5694 | 6aae2a9 | 2011-06-10 01:16:51 -0400 | [diff] [blame] | 450 | cerr << "Unable to allocate memory in PartType::AddType()! Partition type list will\n"; |
| 451 | cerr << "be incomplete!\n"; |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 452 | allOK = 0; |
| 453 | } // if/else |
| 454 | return allOK; |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 455 | } // GUID::AddType(const char* variant) |
| 456 | |
srs5694 | 82f3f0b | 2010-09-22 10:50:24 -0400 | [diff] [blame] | 457 | // Assignment operator by string. If the original string is short, |
| 458 | // interpret it as a gdisk hex code; if it's longer, interpret it as |
srs5694 | 0873e9d | 2010-10-07 13:00:45 -0400 | [diff] [blame] | 459 | // a direct entry of a GUID value. If a short string isn't a hex |
| 460 | // number, do nothing. |
srs5694 | 82f3f0b | 2010-09-22 10:50:24 -0400 | [diff] [blame] | 461 | PartType & PartType::operator=(const string & orig) { |
| 462 | uint32_t hexCode; |
| 463 | |
| 464 | if (orig.length() < 32) { |
srs5694 | 0873e9d | 2010-10-07 13:00:45 -0400 | [diff] [blame] | 465 | if (IsHex(orig)) { |
| 466 | sscanf(orig.c_str(), "%x", &hexCode); |
| 467 | *this = hexCode; |
srs5694 | a17fe69 | 2011-09-10 20:30:20 -0400 | [diff] [blame] | 468 | } |
srs5694 | 82f3f0b | 2010-09-22 10:50:24 -0400 | [diff] [blame] | 469 | } else { |
| 470 | GUIDData::operator=(orig); |
| 471 | } // if/else hexCode or GUID |
| 472 | return *this; |
| 473 | } // PartType::operator=(const char * orig) |
| 474 | |
| 475 | // Assignment from C-style string; rely on C++ casting.... |
| 476 | PartType & PartType::operator=(const char * orig) { |
| 477 | return operator=((string) orig); |
| 478 | } // PartType::operator=(const char * orig) |
| 479 | |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 480 | // Assign a GUID based on my custom 2-byte (16-bit) MBR hex ID variant |
srs5694 | cb76c67 | 2010-02-11 22:22:22 -0500 | [diff] [blame] | 481 | PartType & PartType::operator=(uint16_t ID) { |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 482 | AType* theItem = allTypes; |
| 483 | int found = 0; |
| 484 | |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 485 | // Now search the type list for a match to the ID.... |
| 486 | while ((theItem != NULL) && (!found)) { |
srs5694 | 55d9261 | 2010-03-07 22:16:07 -0500 | [diff] [blame] | 487 | if (theItem->MBRType == ID) { |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 488 | GUIDData::operator=(theItem->GUIDType); |
| 489 | found = 1; |
| 490 | } else { |
| 491 | theItem = theItem->next; |
| 492 | } // if/else |
| 493 | } // while |
| 494 | if (!found) { |
srs5694 | 55d9261 | 2010-03-07 22:16:07 -0500 | [diff] [blame] | 495 | // Assign a default value.... |
srs5694 | 0741fa2 | 2013-01-09 12:55:40 -0500 | [diff] [blame] | 496 | operator=(DEFAULT_GPT_TYPE); |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 497 | cout.setf(ios::uppercase); |
| 498 | cout.fill('0'); |
| 499 | cout << "Exact type match not found for type code "; |
| 500 | cout.width(4); |
srs5694 | 00b6d7a | 2011-06-26 22:40:06 -0400 | [diff] [blame] | 501 | cout << hex << ID << "; assigning type code for\n'" << TypeName() << "'\n" << dec; |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 502 | cout.fill(' '); |
| 503 | } // if (!found) |
| 504 | return *this; |
| 505 | } // PartType::operator=(uint16_t ID) |
| 506 | |
srs5694 | 00b6d7a | 2011-06-26 22:40:06 -0400 | [diff] [blame] | 507 | // Return the English description of the partition type (e.g., "Linux filesystem") |
srs5694 | 5a08175 | 2010-09-24 20:39:41 -0400 | [diff] [blame] | 508 | string PartType::TypeName(void) const { |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 509 | AType* theItem = allTypes; |
| 510 | int found = 0; |
| 511 | string typeName; |
| 512 | |
| 513 | while ((theItem != NULL) && (!found)) { |
| 514 | if (theItem->GUIDType == *this) { // found it! |
| 515 | typeName = theItem->name; |
| 516 | found = 1; |
| 517 | } else { |
| 518 | theItem = theItem->next; |
| 519 | } // if/else |
| 520 | } // while |
| 521 | if (!found) { |
| 522 | typeName = "Unknown"; |
| 523 | } // if (!found) |
| 524 | return typeName; |
| 525 | } // PartType::TypeName() |
| 526 | |
Roderick W. Smith | 84aaff6 | 2014-02-17 16:17:11 -0500 | [diff] [blame] | 527 | #ifdef USE_UTF16 |
srs5694 | 00b6d7a | 2011-06-26 22:40:06 -0400 | [diff] [blame] | 528 | // Return the Unicode description of the partition type (e.g., "Linux filesystem") |
srs5694 | 5a60853 | 2011-03-17 13:53:01 -0400 | [diff] [blame] | 529 | UnicodeString PartType::UTypeName(void) const { |
| 530 | AType* theItem = allTypes; |
| 531 | int found = 0; |
| 532 | UnicodeString typeName; |
| 533 | |
| 534 | while ((theItem != NULL) && (!found)) { |
| 535 | if (theItem->GUIDType == *this) { // found it! |
| 536 | typeName = theItem->name.c_str(); |
| 537 | found = 1; |
| 538 | } else { |
| 539 | theItem = theItem->next; |
| 540 | } // if/else |
| 541 | } // while |
| 542 | if (!found) { |
| 543 | typeName = "Unknown"; |
| 544 | } // if (!found) |
| 545 | return typeName; |
| 546 | } // PartType::TypeName() |
Roderick W. Smith | 84aaff6 | 2014-02-17 16:17:11 -0500 | [diff] [blame] | 547 | #endif |
srs5694 | 5a60853 | 2011-03-17 13:53:01 -0400 | [diff] [blame] | 548 | |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 549 | // Return the custom GPT fdisk 2-byte (16-bit) hex code for this GUID partition type |
| 550 | // Note that this function ignores entries for which the display variable |
| 551 | // is set to 0. This enables control of which values get returned when |
| 552 | // there are multiple possibilities, but opens the algorithm up to the |
| 553 | // potential for problems should the data in the list be bad. |
srs5694 | 5a08175 | 2010-09-24 20:39:41 -0400 | [diff] [blame] | 554 | uint16_t PartType::GetHexType() const { |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 555 | AType* theItem = allTypes; |
| 556 | int found = 0; |
| 557 | uint16_t theID = 0xFFFF; |
| 558 | |
| 559 | while ((theItem != NULL) && (!found)) { |
| 560 | if ((theItem->GUIDType == *this) && (theItem->display == 1)) { // found it! |
| 561 | theID = theItem->MBRType; |
| 562 | found = 1; |
| 563 | } else { |
| 564 | theItem = theItem->next; |
| 565 | } // if/else |
| 566 | } // while |
| 567 | if (!found) { |
| 568 | theID = 0xFFFF; |
| 569 | } // if (!found) |
| 570 | return theID; |
| 571 | } // PartType::GetHex() |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 572 | |
| 573 | // Displays the available types and my extended MBR codes for same.... |
| 574 | // Note: This function assumes an 80-column display. On wider displays, |
| 575 | // it stops at under 80 columns; on narrower displays, lines will wrap |
Roderick W. Smith | e3ee733 | 2013-09-24 12:56:11 -0400 | [diff] [blame] | 576 | // in an ugly way. The maxLines value is the maximum number of lines |
| 577 | // to display before prompting to continue, or 0 (or a negative value) |
Rod Smith | 44cda47 | 2018-07-05 09:07:58 -0400 | [diff] [blame] | 578 | // for no limit. If (maxLines > 0), this function will prompt for a |
| 579 | // substring to search for in the partition type description, so it's |
| 580 | // imperative that maxLines be set to 0 in non-interactive contexts |
| 581 | // (namely, sgdisk). |
Roderick W. Smith | e3ee733 | 2013-09-24 12:56:11 -0400 | [diff] [blame] | 582 | void PartType::ShowAllTypes(int maxLines) const { |
| 583 | int colCount = 1, lineCount = 1; |
srs5694 | e321d44 | 2010-01-29 17:44:04 -0500 | [diff] [blame] | 584 | size_t i; |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 585 | AType* thisType = allTypes; |
Rod Smith | 44cda47 | 2018-07-05 09:07:58 -0400 | [diff] [blame] | 586 | string line, matchString = ""; |
| 587 | size_t found; |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 588 | |
srs5694 | fed16d0 | 2010-01-27 23:03:40 -0500 | [diff] [blame] | 589 | cout.unsetf(ios::uppercase); |
Rod Smith | 44cda47 | 2018-07-05 09:07:58 -0400 | [diff] [blame] | 590 | if (maxLines > 0) { |
| 591 | cout << "Type search string, or <Enter> to show all codes: "; |
Gilles Moris | f9d08a6 | 2019-05-15 07:33:38 +0200 | [diff] [blame] | 592 | matchString = ToLower(ReadString()); |
Rod Smith | 44cda47 | 2018-07-05 09:07:58 -0400 | [diff] [blame] | 593 | } // if |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 594 | while (thisType != NULL) { |
Gilles Moris | f9d08a6 | 2019-05-15 07:33:38 +0200 | [diff] [blame] | 595 | found = ToLower(thisType->name).find(matchString); |
Rod Smith | 44cda47 | 2018-07-05 09:07:58 -0400 | [diff] [blame] | 596 | if ((thisType->display == 1) && (found != string::npos)) { // show it |
srs5694 | fed16d0 | 2010-01-27 23:03:40 -0500 | [diff] [blame] | 597 | cout.fill('0'); |
| 598 | cout.width(4); |
| 599 | cout << hex << thisType->MBRType << " "; |
Rod Smith | 34fc3ab | 2020-02-09 10:34:44 -0500 | [diff] [blame] | 600 | cout << thisType->name.substr(0, DESC_LENGTH); |
| 601 | for (i = 0; i < (DESC_LENGTH - (thisType->name.substr(0, DESC_LENGTH).length())); i++) |
srs5694 | 55d9261 | 2010-03-07 22:16:07 -0500 | [diff] [blame] | 602 | cout << " "; |
Rod Smith | 34fc3ab | 2020-02-09 10:34:44 -0500 | [diff] [blame] | 603 | if ((colCount % NUM_COLUMNS) == 0) { |
Roderick W. Smith | e3ee733 | 2013-09-24 12:56:11 -0400 | [diff] [blame] | 604 | if (thisType->next) { |
| 605 | cout << "\n"; |
| 606 | if ((maxLines > 0) && (lineCount++ % maxLines) == 0) { |
Gilles Moris | 522273e | 2019-05-15 07:17:40 +0200 | [diff] [blame] | 607 | cout << "Press the <Enter> key to see more codes, q to quit: "; |
Roderick W. Smith | e3ee733 | 2013-09-24 12:56:11 -0400 | [diff] [blame] | 608 | getline(cin, line); |
Gilles Moris | 522273e | 2019-05-15 07:17:40 +0200 | [diff] [blame] | 609 | if ((line[0] =='q') || (line[0] =='Q')) |
| 610 | break; |
Roderick W. Smith | e3ee733 | 2013-09-24 12:56:11 -0400 | [diff] [blame] | 611 | } // if reached screen line limit |
| 612 | } // if there's another entry following this one |
| 613 | } else { |
srs5694 | e321d44 | 2010-01-29 17:44:04 -0500 | [diff] [blame] | 614 | cout << " "; |
Roderick W. Smith | e3ee733 | 2013-09-24 12:56:11 -0400 | [diff] [blame] | 615 | } |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 616 | colCount++; |
| 617 | } // if |
| 618 | thisType = thisType->next; |
| 619 | } // while |
srs5694 | 0a69731 | 2010-01-28 21:10:52 -0500 | [diff] [blame] | 620 | cout.fill(' '); |
| 621 | cout << "\n" << dec; |
Roderick W. Smith | e3ee733 | 2013-09-24 12:56:11 -0400 | [diff] [blame] | 622 | } // PartType::ShowAllTypes(int maxLines) |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 623 | |
| 624 | // Returns 1 if code is a valid extended MBR code, 0 if it's not |
srs5694 | 5a08175 | 2010-09-24 20:39:41 -0400 | [diff] [blame] | 625 | int PartType::Valid(uint16_t code) const { |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 626 | AType* thisType = allTypes; |
| 627 | int found = 0; |
| 628 | |
| 629 | while ((thisType != NULL) && (!found)) { |
| 630 | if (thisType->MBRType == code) { |
| 631 | found = 1; |
| 632 | } // if |
| 633 | thisType = thisType->next; |
| 634 | } // while |
| 635 | return found; |
srs5694 | 6699b01 | 2010-02-04 00:55:30 -0500 | [diff] [blame] | 636 | } // PartType::Valid() |