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