2020-12-12 05:06:23 +08:00
# parted
> A partition manipulation program.
2025-01-05 20:05:32 +02:00
> See also: `parted-interactive`, `partprobe`.
2025-03-26 02:30:50 +02:00
> More information: <https://www.gnu.org/software/parted/manual/html_node/Invoking-Parted.html>.
2020-12-12 05:06:23 +08:00
- List partitions on all block devices:
2025-03-26 02:30:50 +02:00
`sudo parted {{[-l|--list]}}`
2020-12-12 05:06:23 +08:00
2021-03-19 10:10:13 -04:00
- Create a new partition table of the specified label-type:
2020-12-12 05:06:23 +08:00
2025-05-25 09:56:39 +03:00
`sudo parted {{/dev/sdX}} mklabel {{aix|amiga|bsd|dvh|gpt|loop|mac|msdos|pc98|sun}}`
2020-12-12 05:06:23 +08:00
2025-05-25 09:56:39 +03:00
- Create a new `gpt` partition table with a 500MiB boot partition and give the rest for the system partition (`--script` skips user intervention prompts):
2020-12-12 05:06:23 +08:00
2025-05-25 09:56:39 +03:00
`sudo parted {{/dev/sdX}} {{[-s|--script]}} mklabel gpt mkpart "{{boot_partition_name}}" 0% 500MiB mkpart "{{system_partition_name}}" 500MiB 100%`
- Set a partition to have its boot flag turned on:
`sudo parted {{/dev/sdX}} set {{1}} boot on`
2020-12-12 05:06:23 +08:00
2025-01-05 20:05:32 +02:00
- Start interactive mode with the specified disk selected:
2020-12-12 05:06:23 +08:00
2025-01-05 20:05:32 +02:00
`sudo parted {{/dev/sdX}}`
2025-03-26 00:36:41 +02:00
- Display help:
`parted {{[-h|--help]}}`