part.rst 6.6 KB

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