Enric Balletbo i Serra | ff6ef4b | 2023-01-10 17:19:32 +0100 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+: |
| 2 | |
Heinrich Schuchardt | 60971e6 | 2024-01-14 14:53:13 +0100 | [diff] [blame^] | 3 | .. index:: |
| 4 | single: part (command) |
| 5 | |
Enric Balletbo i Serra | ff6ef4b | 2023-01-10 17:19:32 +0100 | [diff] [blame] | 6 | part command |
Heinrich Schuchardt | b214e88 | 2023-10-28 11:59:32 +0200 | [diff] [blame] | 7 | ============ |
Enric Balletbo i Serra | ff6ef4b | 2023-01-10 17:19:32 +0100 | [diff] [blame] | 8 | |
| 9 | Synopis |
| 10 | ------- |
| 11 | |
| 12 | :: |
| 13 | |
| 14 | part uuid <interface> <dev>:<part> [varname] |
| 15 | part list <interface> <dev> [flags] [varname] |
| 16 | part start <interface> <dev> <part> <varname> |
| 17 | part size <interface> <dev> <part> <varname> |
| 18 | part number <interface> <dev> <part> <varname> |
Simon Glass | 125194e | 2023-07-15 21:38:47 -0600 | [diff] [blame] | 19 | part set <interface> <dev> <part> <type> |
Enric Balletbo i Serra | 22e7f1d | 2023-01-10 17:19:34 +0100 | [diff] [blame] | 20 | part type <interface> <dev>:<part> [varname] |
Enric Balletbo i Serra | ff6ef4b | 2023-01-10 17:19:32 +0100 | [diff] [blame] | 21 | part types |
| 22 | |
| 23 | Description |
| 24 | ----------- |
| 25 | |
| 26 | The `part` command is used to manage disk partition related commands. |
| 27 | |
| 28 | The 'part uuid' command prints or sets an environment variable to partition UUID |
| 29 | |
| 30 | interface |
| 31 | interface for accessing the block device (mmc, sata, scsi, usb, ....) |
| 32 | dev |
| 33 | device number |
| 34 | part |
| 35 | partition number |
| 36 | varname |
| 37 | an optional environment variable to store the current partition UUID value into. |
| 38 | |
| 39 | The 'part list' command prints or sets an environment variable to the list of partitions |
| 40 | |
| 41 | interface |
| 42 | interface for accessing the block device (mmc, sata, scsi, usb, ....) |
| 43 | dev |
| 44 | device number |
| 45 | part |
| 46 | partition number |
| 47 | flags |
| 48 | -bootable |
| 49 | lists only bootable partitions |
| 50 | varname |
| 51 | an optional environment variable to store the list of partitions value into. |
| 52 | |
| 53 | The 'part start' commnad sets an environment variable to the start of the partition (in blocks), |
| 54 | part can be either partition number or partition name. |
| 55 | |
| 56 | interface |
| 57 | interface for accessing the block device (mmc, sata, scsi, usb, ....) |
| 58 | dev |
| 59 | device number |
| 60 | part |
| 61 | partition number |
| 62 | varname |
| 63 | a variable to store the current start of the partition value into. |
| 64 | |
| 65 | The 'part size' command sets an environment variable to the size of the partition (in blocks), |
| 66 | part can be either partition number or partition name. |
| 67 | |
| 68 | interface |
| 69 | interface for accessing the block device (mmc, sata, scsi, usb, ....) |
| 70 | dev |
| 71 | device number |
| 72 | part |
| 73 | partition number |
| 74 | varname |
| 75 | a variable to store the current size of the partition value into. |
| 76 | |
| 77 | The 'part number' command sets an environment variable to the partition number using the partition name, |
| 78 | part must be specified as partition name. |
| 79 | |
| 80 | interface |
| 81 | interface for accessing the block device (mmc, sata, scsi, usb, ....) |
| 82 | dev |
| 83 | device number |
| 84 | part |
| 85 | partition number |
| 86 | varname |
| 87 | a variable to store the current partition number value into |
| 88 | |
Simon Glass | 125194e | 2023-07-15 21:38:47 -0600 | [diff] [blame] | 89 | The 'part set' command sets the type of a partition. This is useful when |
| 90 | autodetection fails or does not do the correct thing: |
| 91 | |
| 92 | interface |
| 93 | interface for accessing the block device (mmc, sata, scsi, usb, ....) |
| 94 | dev |
| 95 | device number |
| 96 | part |
| 97 | partition number |
| 98 | type |
| 99 | partition type to use (see 'part types') to check available types |
| 100 | |
Enric Balletbo i Serra | 22e7f1d | 2023-01-10 17:19:34 +0100 | [diff] [blame] | 101 | The 'part type' command prints or sets an environment variable to the partition type UUID. |
| 102 | |
| 103 | interface |
| 104 | interface for accessing the block device (mmc, sata, scsi, usb, ....) |
| 105 | dev |
| 106 | device number |
| 107 | part |
| 108 | partition number |
| 109 | varname |
| 110 | a variable to store the current partition type UUID value into |
| 111 | |
Enric Balletbo i Serra | ff6ef4b | 2023-01-10 17:19:32 +0100 | [diff] [blame] | 112 | The 'part types' command list supported partition table types. |
| 113 | |
| 114 | Examples |
| 115 | -------- |
| 116 | |
| 117 | :: |
| 118 | |
| 119 | => host bind 0 ./test_gpt_disk_image.bin |
| 120 | => part uuid host 0:1 |
| 121 | 24156b69-3378-497f-bb3e-b982223de528 |
| 122 | => part uuid host 0:1 varname |
| 123 | => env print varname |
| 124 | varname=24156b69-3378-497f-bb3e-b982223de528 |
| 125 | => |
| 126 | => part list host 0 |
| 127 | |
| 128 | Partition Map for HOST device 0 -- Partition Type: EFI |
| 129 | |
| 130 | Part Start LBA End LBA Name |
| 131 | Attributes |
| 132 | Type GUID |
| 133 | Partition GUID |
| 134 | 1 0x00000800 0x00000fff "second" |
| 135 | attrs: 0x0000000000000000 |
| 136 | type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 |
| 137 | (data) |
| 138 | guid: 24156b69-3378-497f-bb3e-b982223de528 |
| 139 | 2 0x00001000 0x00001bff "first" |
| 140 | attrs: 0x0000000000000000 |
| 141 | type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 |
| 142 | (data) |
| 143 | guid: 5272ee44-29ab-4d46-af6c-4b45ac67d3b7 |
| 144 | => |
| 145 | => part start host 0 2 varname |
| 146 | => env print varname |
| 147 | varname=1000 |
| 148 | => |
| 149 | => part size host 0 2 varname |
| 150 | => env print varname |
| 151 | varname=c00 |
| 152 | => |
| 153 | => part number host 0 2 varname |
| 154 | => env print varname |
| 155 | varname=0x2 |
| 156 | => |
Enric Balletbo i Serra | 22e7f1d | 2023-01-10 17:19:34 +0100 | [diff] [blame] | 157 | => part type host 0:1 |
| 158 | ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 |
| 159 | => part type host 0:1 varname |
| 160 | => env print varname |
| 161 | varname=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 |
| 162 | => |
Enric Balletbo i Serra | ff6ef4b | 2023-01-10 17:19:32 +0100 | [diff] [blame] | 163 | => part types |
| 164 | Supported partition tables: EFI, AMIGA, DOS, ISO, MAC |
| 165 | |
Simon Glass | 125194e | 2023-07-15 21:38:47 -0600 | [diff] [blame] | 166 | This shows looking at a device with multiple partition tables:: |
| 167 | |
| 168 | => virtio scan |
| 169 | => part list virtio 0 |
| 170 | |
| 171 | Partition Map for VirtIO device 0 -- Partition Type: EFI |
| 172 | |
| 173 | Part Start LBA End LBA Name |
| 174 | Attributes |
| 175 | Type GUID |
| 176 | Partition GUID |
| 177 | 1 0x00000040 0x0092b093 "ISO9660" |
| 178 | attrs: 0x1000000000000001 |
| 179 | type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 |
| 180 | guid: a0891d7e-b930-4513-94d8-f629dbd637b2 |
| 181 | 2 0x0092b094 0x0092d7e7 "Appended2" |
| 182 | attrs: 0x0000000000000000 |
| 183 | type: c12a7328-f81f-11d2-ba4b-00a0c93ec93b |
| 184 | guid: a0891d7e-b930-4513-94db-f629dbd637b2 |
| 185 | 3 0x0092d7e8 0x0092da3f "Gap1" |
| 186 | attrs: 0x1000000000000001 |
| 187 | type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 |
| 188 | guid: a0891d7e-b930-4513-94da-f629dbd637b2 |
| 189 | => ls virtio 0:3 |
| 190 | => part types |
| 191 | Supported partition tables: EFI, DOS, ISO |
| 192 | => part set virtio 0 dos |
| 193 | |
| 194 | Partition Map for VirtIO device 0 -- Partition Type: DOS |
| 195 | |
| 196 | Part Start Sector Num Sectors UUID Type |
| 197 | 1 1 9624191 00000000-01 ee |
| 198 | => part set virtio 0 iso |
| 199 | |
| 200 | Partition Map for VirtIO device 0 -- Partition Type: ISO |
| 201 | |
| 202 | Part Start Sect x Size Type |
| 203 | 1 3020 4 512 U-Boot |
| 204 | 2 9613460 10068 512 U-Boot |
| 205 | => part set virtio 0 efi |
| 206 | |
| 207 | Partition Map for VirtIO device 0 -- Partition Type: EFI |
| 208 | |
| 209 | Part Start LBA End LBA Name |
| 210 | Attributes |
| 211 | Type GUID |
| 212 | Partition GUID |
| 213 | 1 0x00000040 0x0092b093 "ISO9660" |
| 214 | attrs: 0x1000000000000001 |
| 215 | type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 |
| 216 | guid: a0891d7e-b930-4513-94d8-f629dbd637b2 |
| 217 | 2 0x0092b094 0x0092d7e7 "Appended2" |
| 218 | attrs: 0x0000000000000000 |
| 219 | type: c12a7328-f81f-11d2-ba4b-00a0c93ec93b |
| 220 | guid: a0891d7e-b930-4513-94db-f629dbd637b2 |
| 221 | 3 0x0092d7e8 0x0092da3f "Gap1" |
| 222 | attrs: 0x1000000000000001 |
| 223 | type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 |
| 224 | guid: a0891d7e-b930-4513-94da-f629dbd637b2 |
| 225 | => |
| 226 | |
Enric Balletbo i Serra | ff6ef4b | 2023-01-10 17:19:32 +0100 | [diff] [blame] | 227 | Return value |
| 228 | ------------ |
| 229 | |
| 230 | The return value $? is set to 0 (true) if the command succededd. If an |
| 231 | error occurs, the return value $? is set to 1 (false). |